Members:
Lecturer:
Project Description:
Introduction, Background, and Rationale on the Dataset
Opening the dataset, Data exploration for potential bias, Data pre-processing
Model Development
Model Performance Evaluation
XAI (Explainable AI) for the Model
Discussion on Model Performance and Explainability
Summary and Conclusion
In today's airline industry, making customers happy is really important. Airlines want to know what makes passengers satisfied so they can improve their services and relationships. We have decided to choose the Airlines Customer Satisfaction dataset which obtained from Kaggle for this group work. The dataset has a lot of information presented in tabular format, which can help us understand what passengers like and dislike about their flying experiences.
This dataset comprises information about customers who have previously flown with the airline, including their feedback and flight details. The dataset was provided by IIT Roorkee in 2020 as part of a tech competition. The airline stayed anonymous, but was referred to as 'Invistico Airlines'. The primary objective of this dataset is to predict customer satisfaction based on various parameters and identify areas in which the airline can enhance its services to generate more satisfied customers.
1. Relevance: The dataset is directly related to the airline industry, a sector that highly values customer satisfaction. Developing a predictive model using this dataset can provide valuable insights into customer preferences and highlight areas for potential improvements.
2. Practical Application: Accurate prediction of customer satisfaction has significant practical implications for airlines. It empowers them to tailor services, allocate resources efficiently, and elevate customer experiences, ultimately leading to improved customer loyalty and business growth.
pip install lime
Collecting lime
Downloading lime-0.2.0.1.tar.gz (275 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 275.7/275.7 kB 4.8 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from lime) (3.7.1)
Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from lime) (1.23.5)
Requirement already satisfied: scipy in /usr/local/lib/python3.10/dist-packages (from lime) (1.10.1)
Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from lime) (4.66.1)
Requirement already satisfied: scikit-learn>=0.18 in /usr/local/lib/python3.10/dist-packages (from lime) (1.2.2)
Requirement already satisfied: scikit-image>=0.12 in /usr/local/lib/python3.10/dist-packages (from lime) (0.19.3)
Requirement already satisfied: networkx>=2.2 in /usr/local/lib/python3.10/dist-packages (from scikit-image>=0.12->lime) (3.1)
Requirement already satisfied: pillow!=7.1.0,!=7.1.1,!=8.3.0,>=6.1.0 in /usr/local/lib/python3.10/dist-packages (from scikit-image>=0.12->lime) (9.4.0)
Requirement already satisfied: imageio>=2.4.1 in /usr/local/lib/python3.10/dist-packages (from scikit-image>=0.12->lime) (2.31.1)
Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.10/dist-packages (from scikit-image>=0.12->lime) (2023.8.12)
Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from scikit-image>=0.12->lime) (1.4.1)
Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from scikit-image>=0.12->lime) (23.1)
Requirement already satisfied: joblib>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from scikit-learn>=0.18->lime) (1.3.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn>=0.18->lime) (3.2.0)
Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime) (1.1.0)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime) (4.42.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime) (1.4.4)
Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime) (3.1.1)
Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime) (2.8.2)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->lime) (1.16.0)
Building wheels for collected packages: lime
Building wheel for lime (setup.py) ... done
Created wheel for lime: filename=lime-0.2.0.1-py3-none-any.whl size=283835 sha256=3e964a1aea7bd6867bd9063e545ec3e485e1dc63f71a5a158bf164504e0d61ab
Stored in directory: /root/.cache/pip/wheels/fd/a2/af/9ac0a1a85a27f314a06b39e1f492bee1547d52549a4606ed89
Successfully built lime
Installing collected packages: lime
Successfully installed lime-0.2.0.1
pip install shap
Collecting shap
Downloading shap-0.42.1-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (547 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 547.9/547.9 kB 6.1 MB/s eta 0:00:00
Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from shap) (1.23.5)
Requirement already satisfied: scipy in /usr/local/lib/python3.10/dist-packages (from shap) (1.10.1)
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.10/dist-packages (from shap) (1.2.2)
Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from shap) (1.5.3)
Requirement already satisfied: tqdm>=4.27.0 in /usr/local/lib/python3.10/dist-packages (from shap) (4.66.1)
Requirement already satisfied: packaging>20.9 in /usr/local/lib/python3.10/dist-packages (from shap) (23.1)
Collecting slicer==0.0.7 (from shap)
Downloading slicer-0.0.7-py3-none-any.whl (14 kB)
Requirement already satisfied: numba in /usr/local/lib/python3.10/dist-packages (from shap) (0.56.4)
Requirement already satisfied: cloudpickle in /usr/local/lib/python3.10/dist-packages (from shap) (2.2.1)
Requirement already satisfied: llvmlite<0.40,>=0.39.0dev0 in /usr/local/lib/python3.10/dist-packages (from numba->shap) (0.39.1)
Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from numba->shap) (67.7.2)
Requirement already satisfied: python-dateutil>=2.8.1 in /usr/local/lib/python3.10/dist-packages (from pandas->shap) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->shap) (2023.3)
Requirement already satisfied: joblib>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from scikit-learn->shap) (1.3.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn->shap) (3.2.0)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.1->pandas->shap) (1.16.0)
Installing collected packages: slicer, shap
Successfully installed shap-0.42.1 slicer-0.0.7
pip install interpret
Collecting interpret
Downloading interpret-0.4.3-py3-none-any.whl (1.4 kB)
Collecting interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3 (from interpret)
Downloading interpret_core-0.4.3-py3-none-any.whl (16.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.9/16.9 MB 32.4 MB/s eta 0:00:00
Requirement already satisfied: psutil>=5.6.2 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (5.9.5)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (1.3.2)
Requirement already satisfied: ipykernel>=4.10.0 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (5.5.6)
Requirement already satisfied: ipython>=5.5.0 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (7.34.0)
Collecting treeinterpreter>=0.2.2 (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading treeinterpreter-0.2.3-py2.py3-none-any.whl (6.0 kB)
Collecting SALib>=1.3.3 (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading salib-1.4.7-py3-none-any.whl (757 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 758.0/758.0 kB 54.2 MB/s eta 0:00:00
Requirement already satisfied: plotly>=3.8.1 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (5.15.0)
Requirement already satisfied: shap>=0.28.5 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.42.1)
Collecting dill>=0.2.5 (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading dill-0.3.7-py3-none-any.whl (115 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 115.3/115.3 kB 15.6 MB/s eta 0:00:00
Requirement already satisfied: numpy>=1.11.1 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (1.23.5)
Requirement already satisfied: scipy>=0.18.1 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (1.10.1)
Requirement already satisfied: pandas>=0.19.2 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (1.5.3)
Requirement already satisfied: scikit-learn>=0.18.1 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (1.2.2)
Collecting dash>=1.0.0 (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading dash-2.12.1-py3-none-any.whl (10.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.4/10.4 MB 63.6 MB/s eta 0:00:00
Collecting dash-core-components>=1.0.0 (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading dash_core_components-2.0.0-py3-none-any.whl (3.8 kB)
Collecting dash-html-components>=1.0.0 (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading dash_html_components-2.0.0-py3-none-any.whl (4.1 kB)
Collecting dash-table>=4.1.0 (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading dash_table-5.0.0-py3-none-any.whl (3.9 kB)
Collecting dash-cytoscape>=0.1.1 (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading dash_cytoscape-0.3.0-py3-none-any.whl (3.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.6/3.6 MB 74.2 MB/s eta 0:00:00
Collecting gevent>=1.3.6 (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading gevent-23.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.4/6.4 MB 90.2 MB/s eta 0:00:00
Requirement already satisfied: requests>=2.19.0 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2.31.0)
Collecting skope-rules>=1.0.1 (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading skope_rules-1.0.1-py3-none-any.whl (14 kB)
Requirement already satisfied: lime>=0.1.1.33 in /usr/local/lib/python3.10/dist-packages (from interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.2.0.1)
Requirement already satisfied: Flask<2.3.0,>=1.0.4 in /usr/local/lib/python3.10/dist-packages (from dash>=1.0.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2.2.5)
Collecting Werkzeug<2.3.0 (from dash>=1.0.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading Werkzeug-2.2.3-py3-none-any.whl (233 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 233.6/233.6 kB 23.7 MB/s eta 0:00:00
Requirement already satisfied: typing-extensions>=4.1.1 in /usr/local/lib/python3.10/dist-packages (from dash>=1.0.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (4.7.1)
Collecting retrying (from dash>=1.0.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading retrying-1.3.4-py3-none-any.whl (11 kB)
Collecting ansi2html (from dash>=1.0.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading ansi2html-1.8.0-py3-none-any.whl (16 kB)
Requirement already satisfied: nest-asyncio in /usr/local/lib/python3.10/dist-packages (from dash>=1.0.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (1.5.7)
Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from dash>=1.0.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (67.7.2)
Collecting zope.event (from gevent>=1.3.6->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading zope.event-5.0-py3-none-any.whl (6.8 kB)
Collecting zope.interface (from gevent>=1.3.6->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading zope.interface-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (246 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.0/247.0 kB 29.1 MB/s eta 0:00:00
Requirement already satisfied: greenlet>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from gevent>=1.3.6->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2.0.2)
Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.10/dist-packages (from ipykernel>=4.10.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.2.0)
Requirement already satisfied: traitlets>=4.1.0 in /usr/local/lib/python3.10/dist-packages (from ipykernel>=4.10.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (5.7.1)
Requirement already satisfied: jupyter-client in /usr/local/lib/python3.10/dist-packages (from ipykernel>=4.10.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (6.1.12)
Requirement already satisfied: tornado>=4.2 in /usr/local/lib/python3.10/dist-packages (from ipykernel>=4.10.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (6.3.2)
Collecting jedi>=0.16 (from ipython>=5.5.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading jedi-0.19.0-py2.py3-none-any.whl (1.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 64.7 MB/s eta 0:00:00
Requirement already satisfied: decorator in /usr/local/lib/python3.10/dist-packages (from ipython>=5.5.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (4.4.2)
Requirement already satisfied: pickleshare in /usr/local/lib/python3.10/dist-packages (from ipython>=5.5.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.7.5)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from ipython>=5.5.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (3.0.39)
Requirement already satisfied: pygments in /usr/local/lib/python3.10/dist-packages (from ipython>=5.5.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2.16.1)
Requirement already satisfied: backcall in /usr/local/lib/python3.10/dist-packages (from ipython>=5.5.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.2.0)
Requirement already satisfied: matplotlib-inline in /usr/local/lib/python3.10/dist-packages (from ipython>=5.5.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.1.6)
Requirement already satisfied: pexpect>4.3 in /usr/local/lib/python3.10/dist-packages (from ipython>=5.5.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (4.8.0)
Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (3.7.1)
Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (4.66.1)
Requirement already satisfied: scikit-image>=0.12 in /usr/local/lib/python3.10/dist-packages (from lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.19.3)
Requirement already satisfied: python-dateutil>=2.8.1 in /usr/local/lib/python3.10/dist-packages (from pandas>=0.19.2->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas>=0.19.2->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2023.3)
Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly>=3.8.1->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (8.2.3)
Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from plotly>=3.8.1->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (23.1)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.19.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (3.2.0)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.19.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests>=2.19.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.19.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2023.7.22)
Collecting multiprocess (from SALib>=1.3.3->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret)
Downloading multiprocess-0.70.15-py310-none-any.whl (134 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.8/134.8 kB 17.9 MB/s eta 0:00:00
Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn>=0.18.1->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (3.2.0)
Requirement already satisfied: slicer==0.0.7 in /usr/local/lib/python3.10/dist-packages (from shap>=0.28.5->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.0.7)
Requirement already satisfied: numba in /usr/local/lib/python3.10/dist-packages (from shap>=0.28.5->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.56.4)
Requirement already satisfied: cloudpickle in /usr/local/lib/python3.10/dist-packages (from shap>=0.28.5->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2.2.1)
Requirement already satisfied: Jinja2>=3.0 in /usr/local/lib/python3.10/dist-packages (from Flask<2.3.0,>=1.0.4->dash>=1.0.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (3.1.2)
Requirement already satisfied: itsdangerous>=2.0 in /usr/local/lib/python3.10/dist-packages (from Flask<2.3.0,>=1.0.4->dash>=1.0.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2.1.2)
Requirement already satisfied: click>=8.0 in /usr/local/lib/python3.10/dist-packages (from Flask<2.3.0,>=1.0.4->dash>=1.0.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (8.1.7)
Requirement already satisfied: parso<0.9.0,>=0.8.3 in /usr/local/lib/python3.10/dist-packages (from jedi>=0.16->ipython>=5.5.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.8.3)
Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (1.1.0)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (4.42.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (1.4.4)
Requirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (9.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (3.1.1)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.10/dist-packages (from pexpect>4.3->ipython>=5.5.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.7.0)
Requirement already satisfied: wcwidth in /usr/local/lib/python3.10/dist-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=5.5.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.2.6)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.1->pandas>=0.19.2->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (1.16.0)
Requirement already satisfied: networkx>=2.2 in /usr/local/lib/python3.10/dist-packages (from scikit-image>=0.12->lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (3.1)
Requirement already satisfied: imageio>=2.4.1 in /usr/local/lib/python3.10/dist-packages (from scikit-image>=0.12->lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2.31.1)
Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.10/dist-packages (from scikit-image>=0.12->lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2023.8.12)
Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from scikit-image>=0.12->lime>=0.1.1.33->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (1.4.1)
Requirement already satisfied: MarkupSafe>=2.1.1 in /usr/local/lib/python3.10/dist-packages (from Werkzeug<2.3.0->dash>=1.0.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (2.1.3)
Requirement already satisfied: jupyter-core>=4.6.0 in /usr/local/lib/python3.10/dist-packages (from jupyter-client->ipykernel>=4.10.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (5.3.1)
Requirement already satisfied: pyzmq>=13 in /usr/local/lib/python3.10/dist-packages (from jupyter-client->ipykernel>=4.10.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (23.2.1)
Requirement already satisfied: llvmlite<0.40,>=0.39.0dev0 in /usr/local/lib/python3.10/dist-packages (from numba->shap>=0.28.5->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (0.39.1)
Requirement already satisfied: platformdirs>=2.5 in /usr/local/lib/python3.10/dist-packages (from jupyter-core>=4.6.0->jupyter-client->ipykernel>=4.10.0->interpret-core[dash,debug,decisiontree,ebm,lime,linear,notebook,plotly,required,sensitivity,shap,skoperules,treeinterpreter]==0.4.3->interpret) (3.10.0)
Installing collected packages: treeinterpreter, interpret-core, dash-table, dash-html-components, dash-core-components, zope.interface, zope.event, Werkzeug, retrying, jedi, dill, ansi2html, multiprocess, gevent, skope-rules, SALib, dash, dash-cytoscape, interpret
Attempting uninstall: Werkzeug
Found existing installation: Werkzeug 2.3.7
Uninstalling Werkzeug-2.3.7:
Successfully uninstalled Werkzeug-2.3.7
Successfully installed SALib-1.4.7 Werkzeug-2.2.3 ansi2html-1.8.0 dash-2.12.1 dash-core-components-2.0.0 dash-cytoscape-0.3.0 dash-html-components-2.0.0 dash-table-5.0.0 dill-0.3.7 gevent-23.7.0 interpret-0.4.3 interpret-core-0.4.3 jedi-0.19.0 multiprocess-0.70.15 retrying-1.3.4 skope-rules-1.0.1 treeinterpreter-0.2.3 zope.event-5.0 zope.interface-6.0
import matplotlib.pyplot as plt
from numpy import*
import seaborn as sns
from sklearn import*
import pandas as pd
import warnings
warnings.filterwarnings('ignore')
#sklearn
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, confusion_matrix, roc_curve, roc_auc_score
from sklearn.model_selection import cross_val_score
from sklearn.metrics import classification_report
from sklearn.preprocessing import LabelEncoder
import sklearn.preprocessing
# Keras
import tensorflow as tf
from tensorflow import keras
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Dropout
from tensorflow.keras.layers import GaussianNoise
from tensorflow.keras.callbacks import ModelCheckpoint
from tensorflow.keras.callbacks import EarlyStopping
from keras.utils import to_categorical
from keras.optimizers import Adam
#XAI
import lime
import lime.lime_tabular
from __future__ import print_function
import shap
from interpret import set_visualize_provider
from interpret.provider import InlineProvider
set_visualize_provider(InlineProvider())
from interpret import show
from interpret.blackbox import ShapKernel
seed = 1
np.random.seed(seed)
tf.random.set_seed(seed)
df = pd.read_csv('Invistico_Airline.csv')
print("Dataset shape ( rows x columns ):", df.shape)
Dataset shape ( rows x columns ): (129880, 23)
df.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 129880 entries, 0 to 129879 Data columns (total 23 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 satisfaction 129880 non-null object 1 Gender 129880 non-null object 2 Customer Type 129880 non-null object 3 Age 129880 non-null int64 4 Type of Travel 129880 non-null object 5 Class 129880 non-null object 6 Flight Distance 129880 non-null int64 7 Seat comfort 129880 non-null int64 8 Departure/Arrival time convenient 129880 non-null int64 9 Food and drink 129880 non-null int64 10 Gate location 129880 non-null int64 11 Inflight wifi service 129880 non-null int64 12 Inflight entertainment 129880 non-null int64 13 Online support 129880 non-null int64 14 Ease of Online booking 129880 non-null int64 15 On-board service 129880 non-null int64 16 Leg room service 129880 non-null int64 17 Baggage handling 129880 non-null int64 18 Checkin service 129880 non-null int64 19 Cleanliness 129880 non-null int64 20 Online boarding 129880 non-null int64 21 Departure Delay in Minutes 129880 non-null int64 22 Arrival Delay in Minutes 129487 non-null float64 dtypes: float64(1), int64(17), object(5) memory usage: 22.8+ MB
The dataset contains the following variables:
Satisfaction: This variable represents the customer satisfaction level and serves as the target variable for the predictive model. It indicates whether a customer is satisfied or dissatisfied with the airline's services.
Gender: This variable denotes the gender of the customer, indicating whether they are male or female.
Customer Type: This variable classifies customers as either "Loyal Customer" or "Disloyal Customer," based on their previous interactions with the airline.
Age: This variable represents the age of the customer, providing insights into the age distribution of airline passengers.
Type of Travel: This variable categorizes the purpose of the customer's travel, distinguishing between "Business travel" and "Personal travel."
Class: This variable indicates the class of service provided to the customer, such as "Eco" (Economy), "Eco Plus," or "Business."
Flight Distance: This variable quantifies the distance, in miles, covered by the flight taken by the customer.
Seat Comfort: This variable reflects the customer's perception of seat comfort on the flight, measured on a scale from 0 to 5.
Departure/Arrival Time Convenience: This variable captures the customer's satisfaction with the departure and arrival time of the flight, measured on a scale from 0 to 5.
Food and Drink: This variable represents the customer's satisfaction with the food and drink services provided on the flight, rated on a scale from 0 to 5.
Gate Location: This variable indicates the customer's satisfaction with the assigned gate location at the airport, measured on a scale from 0 to 5.
Inflight WiFi Service: This variable measures the quality and satisfaction level of the inflight WiFi service, rated on a scale from 0 to 5.
Inflight Entertainment: This variable reflects the customer's satisfaction with the available inflight entertainment options, rated on a scale from 0 to 5.
Online Support: This variable represents the customer's satisfaction with the online support provided by the airline, rated on a scale from 0 to 5.
Ease of Online Booking: This variable indicates the ease and convenience of the online booking process, rated on a scale from 0 to 5.
On-board Service: This variable captures the customer's satisfaction with the general on-board services offered by the airline, rated on a scale from 0 to 5.
Leg Room Service: This variable reflects the customer's satisfaction with the leg room space provided during the flight, rated on a scale from 0 to 5.
Baggage Handling: This variable measures the customer's satisfaction with the airline's baggage handling process, rated on a scale from 0 to 5.
Check-in Service: This variable represents the customer's satisfaction with the check-in service provided by the airline, rated on a scale from 0 to 5.
Cleanliness: This variable indicates the customer's satisfaction with the cleanliness of the aircraft, rated on a scale from 0 to 5.
Online Boarding: This variable captures the customer's satisfaction with the online boarding process, rated on a scale from 0 to 5.
Departure Delay in Minutes: This variable quantifies the delay in minutes experienced during the departure of the flight.
Arrival Delay in Minutes: This variable quantifies the delay in minutes experienced during the arrival of the flight.
df.sample(5)
| satisfaction | Gender | Customer Type | Age | Type of Travel | Class | Flight Distance | Seat comfort | Departure/Arrival time convenient | Food and drink | ... | Online support | Ease of Online booking | On-board service | Leg room service | Baggage handling | Checkin service | Cleanliness | Online boarding | Departure Delay in Minutes | Arrival Delay in Minutes | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 24303 | dissatisfied | Male | Loyal Customer | 49 | Personal Travel | Eco | 2501 | 3 | 4 | 2 | ... | 5 | 5 | 4 | 4 | 4 | 3 | 4 | 5 | 0 | 0.0 |
| 59503 | satisfied | Male | disloyal Customer | 37 | Business travel | Business | 1624 | 4 | 4 | 4 | ... | 2 | 2 | 4 | 4 | 4 | 5 | 4 | 2 | 12 | 1.0 |
| 63836 | satisfied | Female | Loyal Customer | 43 | Business travel | Business | 1755 | 0 | 0 | 0 | ... | 2 | 1 | 1 | 1 | 1 | 5 | 1 | 1 | 0 | 0.0 |
| 2451 | dissatisfied | Male | Loyal Customer | 47 | Personal Travel | Eco | 1156 | 1 | 3 | 1 | ... | 3 | 3 | 5 | 3 | 3 | 5 | 1 | 3 | 15 | 12.0 |
| 124012 | satisfied | Male | Loyal Customer | 56 | Business travel | Business | 3650 | 2 | 4 | 2 | ... | 3 | 5 | 5 | 5 | 5 | 1 | 5 | 5 | 16 | 7.0 |
5 rows × 23 columns
print("Summary statistics:")
df.describe().T
Summary statistics:
| count | mean | std | min | 25% | 50% | 75% | max | |
|---|---|---|---|---|---|---|---|---|
| Age | 129880.0 | 39.427957 | 15.119360 | 7.0 | 27.0 | 40.0 | 51.0 | 85.0 |
| Flight Distance | 129880.0 | 1981.409055 | 1027.115606 | 50.0 | 1359.0 | 1925.0 | 2544.0 | 6951.0 |
| Seat comfort | 129880.0 | 2.838597 | 1.392983 | 0.0 | 2.0 | 3.0 | 4.0 | 5.0 |
| Departure/Arrival time convenient | 129880.0 | 2.990645 | 1.527224 | 0.0 | 2.0 | 3.0 | 4.0 | 5.0 |
| Food and drink | 129880.0 | 2.851994 | 1.443729 | 0.0 | 2.0 | 3.0 | 4.0 | 5.0 |
| Gate location | 129880.0 | 2.990422 | 1.305970 | 0.0 | 2.0 | 3.0 | 4.0 | 5.0 |
| Inflight wifi service | 129880.0 | 3.249130 | 1.318818 | 0.0 | 2.0 | 3.0 | 4.0 | 5.0 |
| Inflight entertainment | 129880.0 | 3.383477 | 1.346059 | 0.0 | 2.0 | 4.0 | 4.0 | 5.0 |
| Online support | 129880.0 | 3.519703 | 1.306511 | 0.0 | 3.0 | 4.0 | 5.0 | 5.0 |
| Ease of Online booking | 129880.0 | 3.472105 | 1.305560 | 0.0 | 2.0 | 4.0 | 5.0 | 5.0 |
| On-board service | 129880.0 | 3.465075 | 1.270836 | 0.0 | 3.0 | 4.0 | 4.0 | 5.0 |
| Leg room service | 129880.0 | 3.485902 | 1.292226 | 0.0 | 2.0 | 4.0 | 5.0 | 5.0 |
| Baggage handling | 129880.0 | 3.695673 | 1.156483 | 1.0 | 3.0 | 4.0 | 5.0 | 5.0 |
| Checkin service | 129880.0 | 3.340807 | 1.260582 | 0.0 | 3.0 | 3.0 | 4.0 | 5.0 |
| Cleanliness | 129880.0 | 3.705759 | 1.151774 | 0.0 | 3.0 | 4.0 | 5.0 | 5.0 |
| Online boarding | 129880.0 | 3.352587 | 1.298715 | 0.0 | 2.0 | 4.0 | 4.0 | 5.0 |
| Departure Delay in Minutes | 129880.0 | 14.713713 | 38.071126 | 0.0 | 0.0 | 0.0 | 12.0 | 1592.0 |
| Arrival Delay in Minutes | 129487.0 | 15.091129 | 38.465650 | 0.0 | 0.0 | 0.0 | 13.0 | 1584.0 |
missing_values = df.isnull().sum()
print("Missing values:")
print(missing_values)
Missing values: satisfaction 0 Gender 0 Customer Type 0 Age 0 Type of Travel 0 Class 0 Flight Distance 0 Seat comfort 0 Departure/Arrival time convenient 0 Food and drink 0 Gate location 0 Inflight wifi service 0 Inflight entertainment 0 Online support 0 Ease of Online booking 0 On-board service 0 Leg room service 0 Baggage handling 0 Checkin service 0 Cleanliness 0 Online boarding 0 Departure Delay in Minutes 0 Arrival Delay in Minutes 393 dtype: int64
As shown above, there are 393 instances with missing entries for the column 'Arrival Delay in Minutes'. Though we predict that this attribute has predictive power for customer satisfaction, we also predict that it is highly correlated with 'departure delay in minutes'. Therefore, we decided that it would not have too much impact if we removed the missing entries, which only make up 0.3% of the dataset in any case.
# Dropping all the empty rows if any exists
df = df.dropna()
df.info()
<class 'pandas.core.frame.DataFrame'> Int64Index: 129487 entries, 0 to 129879 Data columns (total 23 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 satisfaction 129487 non-null object 1 Gender 129487 non-null object 2 Customer Type 129487 non-null object 3 Age 129487 non-null int64 4 Type of Travel 129487 non-null object 5 Class 129487 non-null object 6 Flight Distance 129487 non-null int64 7 Seat comfort 129487 non-null int64 8 Departure/Arrival time convenient 129487 non-null int64 9 Food and drink 129487 non-null int64 10 Gate location 129487 non-null int64 11 Inflight wifi service 129487 non-null int64 12 Inflight entertainment 129487 non-null int64 13 Online support 129487 non-null int64 14 Ease of Online booking 129487 non-null int64 15 On-board service 129487 non-null int64 16 Leg room service 129487 non-null int64 17 Baggage handling 129487 non-null int64 18 Checkin service 129487 non-null int64 19 Cleanliness 129487 non-null int64 20 Online boarding 129487 non-null int64 21 Departure Delay in Minutes 129487 non-null int64 22 Arrival Delay in Minutes 129487 non-null float64 dtypes: float64(1), int64(17), object(5) memory usage: 23.7+ MB
The following variables need ecoding and will be replaced as below table:
| Class name | 0 | 1 | 2 |
|---|---|---|---|
| Satisfaction | dissatisfied | satisfied | |
| Gender | Female | Male | |
| Customer Type | Disloyal Customer | Loyal Customer | |
| Type of Travel | Personal Travel | Business Travel | |
| Class | Business | Eco | Eco Plus |
df['satisfaction'] = df['satisfaction'].map({'satisfied': 1, 'dissatisfied': 0})
df['Gender'] = df['Gender'].map({'Male': 1, 'Female': 0})
df['Customer Type'] = df['Customer Type'].map({'Loyal Customer': 1, 'disloyal Customer': 0})
df['Type of Travel'] = df['Type of Travel'].map({'Business travel': 1, 'Personal Travel': 0})
df['Class'] = df['Class'].map({'Eco Plus': 2, 'Eco': 1, 'Business': 0})
### Define the function to create pie plot
def plot_pie(df_face, dict, title):
labels = df_face.value_counts().index.tolist()
counts = df_face.value_counts().values.tolist()
for id, list in enumerate(labels):
if dict.__contains__(list):
labels[id] = dict[list]
fig, ax = plt.subplots()
ax.pie(counts, labels=labels, autopct='%1.1f%%')
ax.set_title(title)
# check class distribution
satisfaction_counts = df['satisfaction'].value_counts()
print("\nSatisfaction distribution:")
print(satisfaction_counts)
Satisfaction distribution: 1 70882 0 58605 Name: satisfaction, dtype: int64
sat_dict = { 0: 'Dissatisfied',
1: 'Satisfied' }
plot_pie(df['satisfaction'], sat_dict, "Pie Chart for Satisfaction")
gender_counts = df['Gender'].value_counts()
print("\nGender distribution:")
print(gender_counts)
Gender distribution: 0 65703 1 63784 Name: Gender, dtype: int64
gender_dict = { 0: 'Female',
1: 'Male' }
plot_pie(df['Gender'], gender_dict, "Pie Chart for Gender")
plt.rc('font', size = 20)
df.hist(figsize=(40,40))
plt.show()
# To see which age distribution has higher satisfied / dissatified feedback.
sns.histplot(x='Age', hue='satisfaction', data=df)
plt.title('Satisfaction Count by Age')
plt.legend(labels=['Dissatified', 'Satisfied'])
plt.show()
corr_matrix = df.corr()
plt.figure(figsize=(50, 30))
sns.heatmap(corr_matrix, annot=True, cmap='coolwarm', square=True)
plt.title('Correlation Heatmap of All Variables')
plt.show()
First, though the class distribution is not fully balanced, we are happy with the percentages between both target classes. The demographic attributes Gender and Age seem pretty evenly distributed as well. Notably, when plotting Age against the class variable Satisfaction, we see that there are clear spikes in dissatisfaction for the older ages (between 40-60 years).
Second, we have generate heatmap to see an overall of the correlation between each variables. As expected, there are some highly correlated variables which are Deparute Delay in Minutes and Arrival Delay in Minutes, with a value of 0.97.
For the Satisfaction variable, we now know that the Inflight Entertainment actually has the highest effect which is 0.52. However, this is not considered a strong correlation per se.
Though the histogram showed some interesting peaks when plotting Age against Satisfaction, the correlation is very weak, with only a value of 0.12. Another attribute we expected a stronger correlation with was Class. However, we see it only has a negative correlation of -0.28. Lastly, we see that Gate location and Depature/Arrival time convienent have the weakest correlation with the Satisfaction variable, with values of -0.012 and -0.016 respectively.
feature_names = ["Age", "Gender", "Customer Type", "Type of Travel", "Class",
"Flight Distance", "Seat comfort", "Departure/Arrival time convenient",
"Food and drink", "Gate location", "Inflight wifi service",
"Inflight entertainment", "Online support", "Ease of Online booking",
"On-board service", "Leg room service", "Baggage handling",
"Checkin service", "Cleanliness", "Online boarding",
"Departure Delay in Minutes", "Arrival Delay in Minutes"]
dataT = df[feature_names].values
# Label encoding the target variable
labels = df['satisfaction']
le = sklearn.preprocessing.LabelEncoder()
labels = le.fit_transform(labels)
class_names = le.classes_
dataT = dataT.astype(float)
np.random.seed(1)
train, test, labels_train, labels_test = sklearn.model_selection.train_test_split(dataT, labels, train_size=0.80)
### Define the function to plot the loss and accuracy plot for the model.
def plot_acc_loss(results):
plt.figure(figsize=(15, 5))
plt.subplot(1,2,1)
plt.plot(results.history['loss'])
plt.plot(results.history['val_loss'])
plt.title('Model Loss ')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['train', 'test'], loc='upper left')
plt.subplot(1,2,2)
plt.plot(results.history['acc'])
plt.plot(results.history['val_acc'])
plt.title('Model Accuracy')
plt.ylabel('acc')
plt.xlabel('epoch')
plt.legend(['train', 'test'], loc='upper left')
plt.show()
First model
The validation accuracy converges at around 80%, which indicates the model is learning from the data.
seed = 1
np.random.seed(seed)
tf.random.set_seed(seed)
model_first = Sequential()
model_first.add(Dense(1000, input_dim=22, activation='relu'))
model_first.add(Dense(100, activation='relu'))
model_first.add(Dense(100, activation='relu'))
model_first.add(Dense(50, activation='relu'))
model_first.add(Dense(1, activation='sigmoid'))
# Compile model
model_first.compile(loss='binary_crossentropy', optimizer="adam", metrics=['acc'])
# Fit the model, but this time store the history (that is accuracy and loss for each Epoch)
results = model_first.fit(train, labels_train, validation_split=0.33, epochs=25, batch_size=1000, verbose=1, shuffle=True)
# summarize history for loss and accuracy
plot_acc_loss(results)
Epoch 1/25 70/70 [==============================] - 12s 12ms/step - loss: 4.1725 - acc: 0.5398 - val_loss: 0.6594 - val_acc: 0.5616 Epoch 2/25 70/70 [==============================] - 0s 5ms/step - loss: 0.8436 - acc: 0.5816 - val_loss: 0.7398 - val_acc: 0.5776 Epoch 3/25 70/70 [==============================] - 0s 5ms/step - loss: 0.8161 - acc: 0.6279 - val_loss: 0.5582 - val_acc: 0.7238 Epoch 4/25 70/70 [==============================] - 0s 6ms/step - loss: 0.9307 - acc: 0.6067 - val_loss: 0.5613 - val_acc: 0.7081 Epoch 5/25 70/70 [==============================] - 0s 5ms/step - loss: 0.5427 - acc: 0.7178 - val_loss: 0.5236 - val_acc: 0.7487 Epoch 6/25 70/70 [==============================] - 0s 7ms/step - loss: 0.5250 - acc: 0.7326 - val_loss: 0.4968 - val_acc: 0.7739 Epoch 7/25 70/70 [==============================] - 0s 7ms/step - loss: 0.5293 - acc: 0.7300 - val_loss: 0.6307 - val_acc: 0.6437 Epoch 8/25 70/70 [==============================] - 0s 5ms/step - loss: 0.5228 - acc: 0.7379 - val_loss: 0.4626 - val_acc: 0.7935 Epoch 9/25 70/70 [==============================] - 0s 6ms/step - loss: 0.5476 - acc: 0.7379 - val_loss: 0.8884 - val_acc: 0.5997 Epoch 10/25 70/70 [==============================] - 0s 6ms/step - loss: 0.5581 - acc: 0.7355 - val_loss: 0.4463 - val_acc: 0.8038 Epoch 11/25 70/70 [==============================] - 0s 5ms/step - loss: 0.4596 - acc: 0.7895 - val_loss: 0.4386 - val_acc: 0.8010 Epoch 12/25 70/70 [==============================] - 0s 6ms/step - loss: 0.4879 - acc: 0.7731 - val_loss: 0.4356 - val_acc: 0.8123 Epoch 13/25 70/70 [==============================] - 0s 6ms/step - loss: 0.4768 - acc: 0.7766 - val_loss: 0.4324 - val_acc: 0.8152 Epoch 14/25 70/70 [==============================] - 0s 6ms/step - loss: 0.4759 - acc: 0.7789 - val_loss: 0.4260 - val_acc: 0.8095 Epoch 15/25 70/70 [==============================] - 0s 5ms/step - loss: 0.4508 - acc: 0.7948 - val_loss: 0.4271 - val_acc: 0.8030 Epoch 16/25 70/70 [==============================] - 0s 6ms/step - loss: 0.4543 - acc: 0.7931 - val_loss: 0.4575 - val_acc: 0.8017 Epoch 17/25 70/70 [==============================] - 0s 6ms/step - loss: 0.4336 - acc: 0.8086 - val_loss: 0.4211 - val_acc: 0.8230 Epoch 18/25 70/70 [==============================] - 0s 5ms/step - loss: 0.4607 - acc: 0.7916 - val_loss: 0.5137 - val_acc: 0.7605 Epoch 19/25 70/70 [==============================] - 0s 6ms/step - loss: 0.4467 - acc: 0.8004 - val_loss: 0.4377 - val_acc: 0.8141 Epoch 20/25 70/70 [==============================] - 0s 6ms/step - loss: 0.4427 - acc: 0.8018 - val_loss: 0.4067 - val_acc: 0.8250 Epoch 21/25 70/70 [==============================] - 0s 5ms/step - loss: 0.4493 - acc: 0.7978 - val_loss: 0.4063 - val_acc: 0.8273 Epoch 22/25 70/70 [==============================] - 0s 6ms/step - loss: 0.4657 - acc: 0.7856 - val_loss: 0.4107 - val_acc: 0.8209 Epoch 23/25 70/70 [==============================] - 0s 6ms/step - loss: 0.4239 - acc: 0.8135 - val_loss: 0.4604 - val_acc: 0.8005 Epoch 24/25 70/70 [==============================] - 0s 7ms/step - loss: 0.4267 - acc: 0.8117 - val_loss: 0.4039 - val_acc: 0.8313 Epoch 25/25 70/70 [==============================] - 1s 8ms/step - loss: 0.4166 - acc: 0.8176 - val_loss: 0.4056 - val_acc: 0.8186
print("Accuracy", round(model_first.evaluate(test,labels_test)[1]*100,2), "%")
810/810 [==============================] - 3s 3ms/step - loss: 0.4067 - acc: 0.8190 Accuracy 81.9 %
Better results than the first model, around 82%
# Set the seed for reproducibility
seed = 1
np.random.seed(seed)
tf.random.set_seed(seed)
model = Sequential()
model.add(Dense(1000, input_dim=22, activation='relu'))
model.add(Dense(512, activation='relu'))
model.add(Dense(256, activation='relu'))
model.add(Dense(128, activation='relu'))
model.add(Dense(64, activation='relu'))
model.add(Dense(32, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
# Compile model with custom learning rate
optimizer = Adam(learning_rate=0.001)
model.compile(loss='binary_crossentropy', optimizer=optimizer, metrics=['acc'])
results = model.fit(train, labels_train, validation_split=0.33, epochs=50, batch_size=2000, verbose=1, shuffle=True)
plot_acc_loss(results)
Epoch 1/50 35/35 [==============================] - 1s 15ms/step - loss: 5.4755 - acc: 0.5063 - val_loss: 5.9042 - val_acc: 0.5487 Epoch 2/50 35/35 [==============================] - 0s 9ms/step - loss: 3.0238 - acc: 0.5282 - val_loss: 4.6125 - val_acc: 0.5487 Epoch 3/50 35/35 [==============================] - 0s 7ms/step - loss: 2.0680 - acc: 0.5359 - val_loss: 0.8993 - val_acc: 0.5430 Epoch 4/50 35/35 [==============================] - 0s 7ms/step - loss: 0.6849 - acc: 0.5938 - val_loss: 0.6405 - val_acc: 0.6149 Epoch 5/50 35/35 [==============================] - 0s 7ms/step - loss: 0.6141 - acc: 0.6420 - val_loss: 0.5986 - val_acc: 0.6367 Epoch 6/50 35/35 [==============================] - 0s 8ms/step - loss: 0.9775 - acc: 0.5791 - val_loss: 0.7643 - val_acc: 0.5592 Epoch 7/50 35/35 [==============================] - 0s 7ms/step - loss: 0.6313 - acc: 0.6339 - val_loss: 0.6210 - val_acc: 0.6440 Epoch 8/50 35/35 [==============================] - 0s 7ms/step - loss: 0.5716 - acc: 0.6863 - val_loss: 0.5490 - val_acc: 0.7188 Epoch 9/50 35/35 [==============================] - 0s 7ms/step - loss: 0.5505 - acc: 0.7091 - val_loss: 0.5333 - val_acc: 0.7340 Epoch 10/50 35/35 [==============================] - 0s 8ms/step - loss: 0.5384 - acc: 0.7188 - val_loss: 0.6173 - val_acc: 0.6384 Epoch 11/50 35/35 [==============================] - 0s 7ms/step - loss: 0.5787 - acc: 0.6893 - val_loss: 0.5056 - val_acc: 0.7571 Epoch 12/50 35/35 [==============================] - 0s 7ms/step - loss: 0.5155 - acc: 0.7391 - val_loss: 0.4986 - val_acc: 0.7654 Epoch 13/50 35/35 [==============================] - 0s 7ms/step - loss: 0.5144 - acc: 0.7409 - val_loss: 0.6202 - val_acc: 0.6486 Epoch 14/50 35/35 [==============================] - 0s 7ms/step - loss: 0.5403 - acc: 0.7208 - val_loss: 0.4810 - val_acc: 0.7812 Epoch 15/50 35/35 [==============================] - 0s 7ms/step - loss: 0.5064 - acc: 0.7503 - val_loss: 0.4952 - val_acc: 0.7372 Epoch 16/50 35/35 [==============================] - 0s 7ms/step - loss: 0.5090 - acc: 0.7454 - val_loss: 0.4832 - val_acc: 0.7789 Epoch 17/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4739 - acc: 0.7760 - val_loss: 0.4475 - val_acc: 0.7915 Epoch 18/50 35/35 [==============================] - 0s 7ms/step - loss: 0.5127 - acc: 0.7572 - val_loss: 0.4973 - val_acc: 0.7367 Epoch 19/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4839 - acc: 0.7693 - val_loss: 0.4562 - val_acc: 0.7760 Epoch 20/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4604 - acc: 0.7853 - val_loss: 0.4388 - val_acc: 0.8106 Epoch 21/50 35/35 [==============================] - 0s 7ms/step - loss: 0.5083 - acc: 0.7648 - val_loss: 0.4618 - val_acc: 0.7683 Epoch 22/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4617 - acc: 0.7863 - val_loss: 0.4406 - val_acc: 0.7898 Epoch 23/50 35/35 [==============================] - 0s 10ms/step - loss: 0.4736 - acc: 0.7786 - val_loss: 0.4308 - val_acc: 0.8018 Epoch 24/50 35/35 [==============================] - 0s 9ms/step - loss: 0.4688 - acc: 0.7789 - val_loss: 0.4472 - val_acc: 0.7834 Epoch 25/50 35/35 [==============================] - 0s 9ms/step - loss: 0.4298 - acc: 0.8077 - val_loss: 0.4309 - val_acc: 0.8158 Epoch 26/50 35/35 [==============================] - 0s 9ms/step - loss: 0.4496 - acc: 0.7947 - val_loss: 0.4396 - val_acc: 0.8100 Epoch 27/50 35/35 [==============================] - 0s 9ms/step - loss: 0.4505 - acc: 0.7948 - val_loss: 0.4168 - val_acc: 0.8131 Epoch 28/50 35/35 [==============================] - 0s 11ms/step - loss: 0.4285 - acc: 0.8095 - val_loss: 0.4350 - val_acc: 0.8132 Epoch 29/50 35/35 [==============================] - 0s 9ms/step - loss: 0.4262 - acc: 0.8100 - val_loss: 0.4101 - val_acc: 0.8226 Epoch 30/50 35/35 [==============================] - 0s 9ms/step - loss: 0.4310 - acc: 0.8080 - val_loss: 0.5191 - val_acc: 0.7604 Epoch 31/50 35/35 [==============================] - 0s 9ms/step - loss: 0.4679 - acc: 0.7833 - val_loss: 0.4414 - val_acc: 0.7910 Epoch 32/50 35/35 [==============================] - 0s 11ms/step - loss: 0.4213 - acc: 0.8137 - val_loss: 0.4063 - val_acc: 0.8265 Epoch 33/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4266 - acc: 0.8083 - val_loss: 0.4050 - val_acc: 0.8217 Epoch 34/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4308 - acc: 0.8076 - val_loss: 0.4331 - val_acc: 0.7958 Epoch 35/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4389 - acc: 0.8019 - val_loss: 0.4147 - val_acc: 0.8246 Epoch 36/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4311 - acc: 0.8076 - val_loss: 0.4318 - val_acc: 0.7971 Epoch 37/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4247 - acc: 0.8116 - val_loss: 0.4110 - val_acc: 0.8274 Epoch 38/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4095 - acc: 0.8211 - val_loss: 0.3961 - val_acc: 0.8284 Epoch 39/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4063 - acc: 0.8228 - val_loss: 0.3952 - val_acc: 0.8303 Epoch 40/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4266 - acc: 0.8090 - val_loss: 0.4637 - val_acc: 0.7929 Epoch 41/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4226 - acc: 0.8127 - val_loss: 0.4025 - val_acc: 0.8188 Epoch 42/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4267 - acc: 0.8087 - val_loss: 0.4291 - val_acc: 0.8129 Epoch 43/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4239 - acc: 0.8104 - val_loss: 0.4808 - val_acc: 0.7796 Epoch 44/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4052 - acc: 0.8216 - val_loss: 0.4038 - val_acc: 0.8293 Epoch 45/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4028 - acc: 0.8242 - val_loss: 0.4215 - val_acc: 0.8052 Epoch 46/50 35/35 [==============================] - 0s 8ms/step - loss: 0.3997 - acc: 0.8264 - val_loss: 0.4145 - val_acc: 0.8214 Epoch 47/50 35/35 [==============================] - 0s 7ms/step - loss: 0.3976 - acc: 0.8266 - val_loss: 0.3918 - val_acc: 0.8266 Epoch 48/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4014 - acc: 0.8253 - val_loss: 0.3879 - val_acc: 0.8366 Epoch 49/50 35/35 [==============================] - 0s 7ms/step - loss: 0.3950 - acc: 0.8279 - val_loss: 0.3757 - val_acc: 0.8398 Epoch 50/50 35/35 [==============================] - 0s 7ms/step - loss: 0.4083 - acc: 0.8175 - val_loss: 0.3902 - val_acc: 0.8262
print("Accuracy", round(model.evaluate(test,labels_test)[1]*100,2), "%")
810/810 [==============================] - 2s 2ms/step - loss: 0.3923 - acc: 0.8263 Accuracy 82.63 %
Overall the accuracy converges at around 92%.
# Set the seed for reproducibility
seed = 1
np.random.seed(seed)
tf.random.set_seed(seed)
model = Sequential()
model.add(Dense(1000, input_dim=22, activation='relu'))
model.add(Dense(500, activation='relu'))
model.add(Dense(100, activation='relu'))
model.add(Dense(50, activation='relu'))
model.add(Dense(10, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
# Compile model
model.compile(loss='binary_crossentropy', optimizer="adam", metrics=['acc'])
# Fit the model, but this time store the history (that is accuracy and loss for each Epoch)
results = model.fit(train, labels_train, validation_data=(test, labels_test), epochs=100, batch_size=1000, verbose=1, shuffle=True)
# summarize history for loss
plot_acc_loss(results)
Epoch 1/100 104/104 [==============================] - 4s 11ms/step - loss: 9.3816 - acc: 0.5196 - val_loss: 1.0199 - val_acc: 0.5577 Epoch 2/100 104/104 [==============================] - 1s 9ms/step - loss: 1.2894 - acc: 0.5648 - val_loss: 0.6725 - val_acc: 0.6037 Epoch 3/100 104/104 [==============================] - 1s 8ms/step - loss: 1.4173 - acc: 0.5675 - val_loss: 0.6276 - val_acc: 0.6014 Epoch 4/100 104/104 [==============================] - 1s 6ms/step - loss: 0.5954 - acc: 0.6702 - val_loss: 0.5462 - val_acc: 0.7105 Epoch 5/100 104/104 [==============================] - 1s 6ms/step - loss: 0.5404 - acc: 0.7180 - val_loss: 0.5016 - val_acc: 0.7556 Epoch 6/100 104/104 [==============================] - 1s 6ms/step - loss: 0.5538 - acc: 0.7172 - val_loss: 0.4727 - val_acc: 0.7799 Epoch 7/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4875 - acc: 0.7657 - val_loss: 0.4565 - val_acc: 0.7983 Epoch 8/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4950 - acc: 0.7653 - val_loss: 0.7967 - val_acc: 0.6358 Epoch 9/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4709 - acc: 0.7805 - val_loss: 0.4343 - val_acc: 0.8126 Epoch 10/100 104/104 [==============================] - 1s 6ms/step - loss: 0.6190 - acc: 0.7419 - val_loss: 1.1573 - val_acc: 0.5885 Epoch 11/100 104/104 [==============================] - 1s 5ms/step - loss: 0.5935 - acc: 0.7301 - val_loss: 0.4707 - val_acc: 0.7640 Epoch 12/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4423 - acc: 0.7992 - val_loss: 0.4226 - val_acc: 0.8187 Epoch 13/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4330 - acc: 0.8073 - val_loss: 0.4586 - val_acc: 0.7764 Epoch 14/100 104/104 [==============================] - 1s 6ms/step - loss: 0.4333 - acc: 0.8063 - val_loss: 0.4105 - val_acc: 0.8234 Epoch 15/100 104/104 [==============================] - 1s 6ms/step - loss: 0.4357 - acc: 0.8053 - val_loss: 0.4474 - val_acc: 0.7870 Epoch 16/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4210 - acc: 0.8150 - val_loss: 0.4223 - val_acc: 0.8056 Epoch 17/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4397 - acc: 0.8050 - val_loss: 0.4143 - val_acc: 0.8134 Epoch 18/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4254 - acc: 0.8114 - val_loss: 0.6293 - val_acc: 0.7108 Epoch 19/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4496 - acc: 0.7971 - val_loss: 0.4010 - val_acc: 0.8330 Epoch 20/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4095 - acc: 0.8209 - val_loss: 0.3956 - val_acc: 0.8255 Epoch 21/100 104/104 [==============================] - 1s 7ms/step - loss: 0.4155 - acc: 0.8157 - val_loss: 0.4008 - val_acc: 0.8211 Epoch 22/100 104/104 [==============================] - 1s 7ms/step - loss: 0.4111 - acc: 0.8198 - val_loss: 0.4411 - val_acc: 0.8074 Epoch 23/100 104/104 [==============================] - 1s 8ms/step - loss: 0.3990 - acc: 0.8267 - val_loss: 0.3852 - val_acc: 0.8391 Epoch 24/100 104/104 [==============================] - 1s 8ms/step - loss: 0.4070 - acc: 0.8199 - val_loss: 0.4572 - val_acc: 0.7834 Epoch 25/100 104/104 [==============================] - 1s 6ms/step - loss: 0.4141 - acc: 0.8169 - val_loss: 0.3927 - val_acc: 0.8220 Epoch 26/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3788 - acc: 0.8347 - val_loss: 0.3999 - val_acc: 0.8185 Epoch 27/100 104/104 [==============================] - 1s 7ms/step - loss: 0.3769 - acc: 0.8342 - val_loss: 0.3708 - val_acc: 0.8364 Epoch 28/100 104/104 [==============================] - 1s 6ms/step - loss: 0.7702 - acc: 0.7346 - val_loss: 0.4270 - val_acc: 0.8336 Epoch 29/100 104/104 [==============================] - 1s 6ms/step - loss: 0.4159 - acc: 0.8254 - val_loss: 0.3919 - val_acc: 0.8356 Epoch 30/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4131 - acc: 0.8232 - val_loss: 0.3956 - val_acc: 0.8223 Epoch 31/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4037 - acc: 0.8204 - val_loss: 0.3678 - val_acc: 0.8439 Epoch 32/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3715 - acc: 0.8398 - val_loss: 0.4510 - val_acc: 0.7977 Epoch 33/100 104/104 [==============================] - 1s 7ms/step - loss: 0.3675 - acc: 0.8406 - val_loss: 0.3478 - val_acc: 0.8555 Epoch 34/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3736 - acc: 0.8371 - val_loss: 0.3434 - val_acc: 0.8524 Epoch 35/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3801 - acc: 0.8356 - val_loss: 0.3353 - val_acc: 0.8578 Epoch 36/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3502 - acc: 0.8481 - val_loss: 0.3256 - val_acc: 0.8617 Epoch 37/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3369 - acc: 0.8552 - val_loss: 0.3448 - val_acc: 0.8527 Epoch 38/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3408 - acc: 0.8529 - val_loss: 0.3148 - val_acc: 0.8696 Epoch 39/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3553 - acc: 0.8466 - val_loss: 0.3201 - val_acc: 0.8647 Epoch 40/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3371 - acc: 0.8564 - val_loss: 0.5887 - val_acc: 0.7276 Epoch 41/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3307 - acc: 0.8607 - val_loss: 0.3120 - val_acc: 0.8682 Epoch 42/100 104/104 [==============================] - 1s 7ms/step - loss: 0.3194 - acc: 0.8655 - val_loss: 0.3066 - val_acc: 0.8730 Epoch 43/100 104/104 [==============================] - 1s 7ms/step - loss: 0.3186 - acc: 0.8650 - val_loss: 0.3233 - val_acc: 0.8636 Epoch 44/100 104/104 [==============================] - 1s 8ms/step - loss: 0.3117 - acc: 0.8674 - val_loss: 0.3164 - val_acc: 0.8667 Epoch 45/100 104/104 [==============================] - 1s 8ms/step - loss: 0.3136 - acc: 0.8654 - val_loss: 0.3542 - val_acc: 0.8444 Epoch 46/100 104/104 [==============================] - 1s 7ms/step - loss: 0.3036 - acc: 0.8708 - val_loss: 0.3803 - val_acc: 0.8282 Epoch 47/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3049 - acc: 0.8695 - val_loss: 0.2858 - val_acc: 0.8782 Epoch 48/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2948 - acc: 0.8740 - val_loss: 0.2951 - val_acc: 0.8758 Epoch 49/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2939 - acc: 0.8744 - val_loss: 0.2855 - val_acc: 0.8784 Epoch 50/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3047 - acc: 0.8693 - val_loss: 0.2908 - val_acc: 0.8792 Epoch 51/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2863 - acc: 0.8800 - val_loss: 0.2777 - val_acc: 0.8864 Epoch 52/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3055 - acc: 0.8702 - val_loss: 0.3402 - val_acc: 0.8484 Epoch 53/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2828 - acc: 0.8795 - val_loss: 0.3139 - val_acc: 0.8652 Epoch 54/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2774 - acc: 0.8815 - val_loss: 0.2982 - val_acc: 0.8681 Epoch 55/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2815 - acc: 0.8787 - val_loss: 0.3409 - val_acc: 0.8519 Epoch 56/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2906 - acc: 0.8763 - val_loss: 0.2696 - val_acc: 0.8886 Epoch 57/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2882 - acc: 0.8773 - val_loss: 0.2730 - val_acc: 0.8857 Epoch 58/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2676 - acc: 0.8849 - val_loss: 0.3167 - val_acc: 0.8590 Epoch 59/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2695 - acc: 0.8844 - val_loss: 0.4038 - val_acc: 0.8243 Epoch 60/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2654 - acc: 0.8862 - val_loss: 0.2504 - val_acc: 0.8928 Epoch 61/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2842 - acc: 0.8788 - val_loss: 0.2564 - val_acc: 0.8925 Epoch 62/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2611 - acc: 0.8890 - val_loss: 0.2537 - val_acc: 0.8916 Epoch 63/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2528 - acc: 0.8930 - val_loss: 0.2420 - val_acc: 0.8978 Epoch 64/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2500 - acc: 0.8939 - val_loss: 0.2429 - val_acc: 0.8952 Epoch 65/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2489 - acc: 0.8941 - val_loss: 0.2446 - val_acc: 0.8949 Epoch 66/100 104/104 [==============================] - 1s 8ms/step - loss: 0.2426 - acc: 0.8971 - val_loss: 0.2579 - val_acc: 0.8876 Epoch 67/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2446 - acc: 0.8953 - val_loss: 0.2270 - val_acc: 0.9034 Epoch 68/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2405 - acc: 0.8975 - val_loss: 0.2290 - val_acc: 0.9011 Epoch 69/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2418 - acc: 0.8962 - val_loss: 0.2474 - val_acc: 0.8941 Epoch 70/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2489 - acc: 0.8936 - val_loss: 0.2277 - val_acc: 0.9038 Epoch 71/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2494 - acc: 0.8934 - val_loss: 0.2735 - val_acc: 0.8790 Epoch 72/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2402 - acc: 0.8978 - val_loss: 0.2377 - val_acc: 0.8967 Epoch 73/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2338 - acc: 0.9001 - val_loss: 0.2122 - val_acc: 0.9097 Epoch 74/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2330 - acc: 0.8997 - val_loss: 0.2248 - val_acc: 0.9039 Epoch 75/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2263 - acc: 0.9031 - val_loss: 0.2598 - val_acc: 0.8947 Epoch 76/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2357 - acc: 0.8981 - val_loss: 0.2848 - val_acc: 0.8739 Epoch 77/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2379 - acc: 0.8990 - val_loss: 0.2344 - val_acc: 0.8991 Epoch 78/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2318 - acc: 0.9009 - val_loss: 0.2321 - val_acc: 0.9017 Epoch 79/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2305 - acc: 0.9010 - val_loss: 0.2085 - val_acc: 0.9106 Epoch 80/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2276 - acc: 0.9015 - val_loss: 0.2118 - val_acc: 0.9081 Epoch 81/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2132 - acc: 0.9086 - val_loss: 0.2044 - val_acc: 0.9126 Epoch 82/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2110 - acc: 0.9102 - val_loss: 0.2340 - val_acc: 0.8983 Epoch 83/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2157 - acc: 0.9080 - val_loss: 0.2252 - val_acc: 0.9035 Epoch 84/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2232 - acc: 0.9036 - val_loss: 0.2331 - val_acc: 0.9054 Epoch 85/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2143 - acc: 0.9079 - val_loss: 0.2112 - val_acc: 0.9104 Epoch 86/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2179 - acc: 0.9057 - val_loss: 0.1949 - val_acc: 0.9165 Epoch 87/100 104/104 [==============================] - 1s 8ms/step - loss: 0.2069 - acc: 0.9111 - val_loss: 0.1995 - val_acc: 0.9132 Epoch 88/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2110 - acc: 0.9091 - val_loss: 0.2099 - val_acc: 0.9113 Epoch 89/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2066 - acc: 0.9115 - val_loss: 0.2116 - val_acc: 0.9106 Epoch 90/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2033 - acc: 0.9134 - val_loss: 0.1941 - val_acc: 0.9162 Epoch 91/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2024 - acc: 0.9128 - val_loss: 0.2017 - val_acc: 0.9146 Epoch 92/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2089 - acc: 0.9107 - val_loss: 0.2106 - val_acc: 0.9080 Epoch 93/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2018 - acc: 0.9125 - val_loss: 0.2035 - val_acc: 0.9123 Epoch 94/100 104/104 [==============================] - 1s 9ms/step - loss: 0.2090 - acc: 0.9097 - val_loss: 0.1902 - val_acc: 0.9199 Epoch 95/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2011 - acc: 0.9137 - val_loss: 0.1914 - val_acc: 0.9176 Epoch 96/100 104/104 [==============================] - 1s 10ms/step - loss: 0.1975 - acc: 0.9149 - val_loss: 0.1854 - val_acc: 0.9201 Epoch 97/100 104/104 [==============================] - 1s 8ms/step - loss: 0.1970 - acc: 0.9147 - val_loss: 0.1876 - val_acc: 0.9191 Epoch 98/100 104/104 [==============================] - 1s 8ms/step - loss: 0.1970 - acc: 0.9147 - val_loss: 0.1812 - val_acc: 0.9226 Epoch 99/100 104/104 [==============================] - 1s 6ms/step - loss: 0.1955 - acc: 0.9146 - val_loss: 0.2161 - val_acc: 0.9066 Epoch 100/100 104/104 [==============================] - 1s 6ms/step - loss: 0.1975 - acc: 0.9146 - val_loss: 0.1819 - val_acc: 0.9246
print("Accuracy", round(model.evaluate(test,labels_test)[1]*100,2), "%")
810/810 [==============================] - 2s 2ms/step - loss: 0.1819 - acc: 0.9246 Accuracy 92.46 %
The validation accuracy is around 87%
# Set the seed for reproducibility
seed = 1
np.random.seed(seed)
tf.random.set_seed(seed)
model = Sequential()
model.add(Dense(2048, input_dim=22, activation='relu'))
model.add(Dense(1024, activation='relu'))
model.add(Dense(512, activation='relu'))
model.add(Dense(256, activation='relu'))
model.add(Dense(128, activation='relu'))
model.add(Dense(64, activation='relu'))
model.add(Dense(32, activation='relu'))
model.add(Dense(16, activation='relu'))
model.add(Dense(8, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
# Compile model with custom learning rate
optimizer = Adam(learning_rate=0.001)
model.compile(loss='binary_crossentropy', optimizer=optimizer, metrics=['acc'])
results = model.fit(train, labels_train, validation_split=0.33, epochs=75, batch_size=2000, verbose=1, shuffle=True)
plot_acc_loss(results)
Epoch 1/75 35/35 [==============================] - 2s 24ms/step - loss: 3.1992 - acc: 0.5028 - val_loss: 1.9723 - val_acc: 0.5487 Epoch 2/75 35/35 [==============================] - 0s 14ms/step - loss: 0.8547 - acc: 0.5362 - val_loss: 0.6827 - val_acc: 0.5649 Epoch 3/75 35/35 [==============================] - 0s 14ms/step - loss: 0.6821 - acc: 0.5697 - val_loss: 0.6605 - val_acc: 0.5978 Epoch 4/75 35/35 [==============================] - 0s 14ms/step - loss: 0.6606 - acc: 0.5881 - val_loss: 0.6430 - val_acc: 0.6209 Epoch 5/75 35/35 [==============================] - 0s 14ms/step - loss: 0.6525 - acc: 0.5970 - val_loss: 0.6210 - val_acc: 0.6063 Epoch 6/75 35/35 [==============================] - 0s 14ms/step - loss: 0.6276 - acc: 0.6293 - val_loss: 0.6416 - val_acc: 0.6362 Epoch 7/75 35/35 [==============================] - 1s 16ms/step - loss: 0.6327 - acc: 0.6407 - val_loss: 0.5683 - val_acc: 0.6943 Epoch 8/75 35/35 [==============================] - 0s 14ms/step - loss: 0.5781 - acc: 0.6839 - val_loss: 0.5893 - val_acc: 0.6507 Epoch 9/75 35/35 [==============================] - 1s 16ms/step - loss: 0.5480 - acc: 0.7134 - val_loss: 0.5151 - val_acc: 0.7454 Epoch 10/75 35/35 [==============================] - 1s 16ms/step - loss: 0.5548 - acc: 0.7074 - val_loss: 0.5007 - val_acc: 0.7552 Epoch 11/75 35/35 [==============================] - 0s 14ms/step - loss: 0.5522 - acc: 0.7034 - val_loss: 0.6174 - val_acc: 0.5547 Epoch 12/75 35/35 [==============================] - 1s 16ms/step - loss: 0.7514 - acc: 0.6328 - val_loss: 0.9595 - val_acc: 0.4742 Epoch 13/75 35/35 [==============================] - 1s 17ms/step - loss: 0.7161 - acc: 0.5398 - val_loss: 0.6586 - val_acc: 0.5464 Epoch 14/75 35/35 [==============================] - 1s 17ms/step - loss: 0.6785 - acc: 0.5612 - val_loss: 0.6425 - val_acc: 0.5752 Epoch 15/75 35/35 [==============================] - 1s 17ms/step - loss: 0.6849 - acc: 0.5823 - val_loss: 0.5962 - val_acc: 0.6875 Epoch 16/75 35/35 [==============================] - 1s 16ms/step - loss: 0.6358 - acc: 0.6643 - val_loss: 0.5778 - val_acc: 0.7253 Epoch 17/75 35/35 [==============================] - 1s 15ms/step - loss: 0.5442 - acc: 0.7219 - val_loss: 0.5178 - val_acc: 0.7383 Epoch 18/75 35/35 [==============================] - 1s 16ms/step - loss: 0.5096 - acc: 0.7473 - val_loss: 0.4825 - val_acc: 0.7668 Epoch 19/75 35/35 [==============================] - 1s 16ms/step - loss: 0.4990 - acc: 0.7558 - val_loss: 0.4752 - val_acc: 0.7810 Epoch 20/75 35/35 [==============================] - 0s 14ms/step - loss: 0.4996 - acc: 0.7538 - val_loss: 0.4642 - val_acc: 0.7774 Epoch 21/75 35/35 [==============================] - 1s 16ms/step - loss: 0.4768 - acc: 0.7728 - val_loss: 0.4472 - val_acc: 0.7957 Epoch 22/75 35/35 [==============================] - 1s 17ms/step - loss: 0.4582 - acc: 0.7866 - val_loss: 0.4467 - val_acc: 0.7894 Epoch 23/75 35/35 [==============================] - 1s 16ms/step - loss: 0.4559 - acc: 0.7885 - val_loss: 0.4552 - val_acc: 0.7799 Epoch 24/75 35/35 [==============================] - 1s 14ms/step - loss: 0.4586 - acc: 0.7875 - val_loss: 0.4445 - val_acc: 0.8104 Epoch 25/75 35/35 [==============================] - 0s 14ms/step - loss: 0.4501 - acc: 0.7930 - val_loss: 0.4240 - val_acc: 0.8133 Epoch 26/75 35/35 [==============================] - 0s 14ms/step - loss: 0.4406 - acc: 0.8001 - val_loss: 0.4261 - val_acc: 0.8042 Epoch 27/75 35/35 [==============================] - 0s 14ms/step - loss: 0.4385 - acc: 0.8013 - val_loss: 0.4135 - val_acc: 0.8173 Epoch 28/75 35/35 [==============================] - 0s 14ms/step - loss: 0.4262 - acc: 0.8096 - val_loss: 0.4123 - val_acc: 0.8213 Epoch 29/75 35/35 [==============================] - 1s 16ms/step - loss: 0.4237 - acc: 0.8127 - val_loss: 0.4095 - val_acc: 0.8186 Epoch 30/75 35/35 [==============================] - 0s 14ms/step - loss: 0.4399 - acc: 0.8031 - val_loss: 0.4194 - val_acc: 0.8112 Epoch 31/75 35/35 [==============================] - 0s 14ms/step - loss: 0.4261 - acc: 0.8105 - val_loss: 0.4195 - val_acc: 0.8086 Epoch 32/75 35/35 [==============================] - 0s 14ms/step - loss: 0.4167 - acc: 0.8159 - val_loss: 0.4157 - val_acc: 0.8126 Epoch 33/75 35/35 [==============================] - 1s 16ms/step - loss: 0.4156 - acc: 0.8162 - val_loss: 0.4079 - val_acc: 0.8250 Epoch 34/75 35/35 [==============================] - 1s 16ms/step - loss: 0.4151 - acc: 0.8167 - val_loss: 0.3989 - val_acc: 0.8297 Epoch 35/75 35/35 [==============================] - 0s 14ms/step - loss: 0.4166 - acc: 0.8159 - val_loss: 0.4249 - val_acc: 0.8051 Epoch 36/75 35/35 [==============================] - 1s 15ms/step - loss: 0.4233 - acc: 0.8122 - val_loss: 0.4015 - val_acc: 0.8221 Epoch 37/75 35/35 [==============================] - 1s 16ms/step - loss: 0.4075 - acc: 0.8224 - val_loss: 0.4520 - val_acc: 0.8052 Epoch 38/75 35/35 [==============================] - 1s 15ms/step - loss: 0.4184 - acc: 0.8162 - val_loss: 0.4492 - val_acc: 0.8049 Epoch 39/75 35/35 [==============================] - 1s 15ms/step - loss: 0.4099 - acc: 0.8194 - val_loss: 0.3904 - val_acc: 0.8342 Epoch 40/75 35/35 [==============================] - 1s 17ms/step - loss: 0.4049 - acc: 0.8233 - val_loss: 0.4038 - val_acc: 0.8180 Epoch 41/75 35/35 [==============================] - 1s 16ms/step - loss: 0.4046 - acc: 0.8228 - val_loss: 0.4081 - val_acc: 0.8171 Epoch 42/75 35/35 [==============================] - 1s 17ms/step - loss: 0.4001 - acc: 0.8251 - val_loss: 0.3852 - val_acc: 0.8359 Epoch 43/75 35/35 [==============================] - 0s 14ms/step - loss: 0.4021 - acc: 0.8253 - val_loss: 0.3849 - val_acc: 0.8360 Epoch 44/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3972 - acc: 0.8265 - val_loss: 0.3825 - val_acc: 0.8373 Epoch 45/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3897 - acc: 0.8312 - val_loss: 0.3788 - val_acc: 0.8388 Epoch 46/75 35/35 [==============================] - 1s 16ms/step - loss: 0.3872 - acc: 0.8324 - val_loss: 0.3875 - val_acc: 0.8339 Epoch 47/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3933 - acc: 0.8282 - val_loss: 0.3845 - val_acc: 0.8309 Epoch 48/75 35/35 [==============================] - 1s 16ms/step - loss: 0.3856 - acc: 0.8333 - val_loss: 0.3751 - val_acc: 0.8397 Epoch 49/75 35/35 [==============================] - 1s 16ms/step - loss: 0.3895 - acc: 0.8289 - val_loss: 0.3675 - val_acc: 0.8414 Epoch 50/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3808 - acc: 0.8314 - val_loss: 0.3639 - val_acc: 0.8384 Epoch 51/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3639 - acc: 0.8371 - val_loss: 0.3617 - val_acc: 0.8444 Epoch 52/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3787 - acc: 0.8301 - val_loss: 0.3476 - val_acc: 0.8436 Epoch 53/75 35/35 [==============================] - 1s 14ms/step - loss: 0.3777 - acc: 0.8312 - val_loss: 0.4064 - val_acc: 0.8238 Epoch 54/75 35/35 [==============================] - 1s 16ms/step - loss: 0.3909 - acc: 0.8303 - val_loss: 0.3605 - val_acc: 0.8429 Epoch 55/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3792 - acc: 0.8333 - val_loss: 0.3545 - val_acc: 0.8425 Epoch 56/75 35/35 [==============================] - 1s 16ms/step - loss: 0.3674 - acc: 0.8348 - val_loss: 0.3356 - val_acc: 0.8464 Epoch 57/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3637 - acc: 0.8360 - val_loss: 0.3330 - val_acc: 0.8527 Epoch 58/75 35/35 [==============================] - 1s 16ms/step - loss: 0.3376 - acc: 0.8475 - val_loss: 0.3389 - val_acc: 0.8470 Epoch 59/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3449 - acc: 0.8466 - val_loss: 0.3822 - val_acc: 0.8212 Epoch 60/75 35/35 [==============================] - 1s 16ms/step - loss: 0.3800 - acc: 0.8302 - val_loss: 0.3673 - val_acc: 0.8452 Epoch 61/75 35/35 [==============================] - 1s 14ms/step - loss: 0.3402 - acc: 0.8522 - val_loss: 0.3405 - val_acc: 0.8536 Epoch 62/75 35/35 [==============================] - 1s 17ms/step - loss: 0.3306 - acc: 0.8555 - val_loss: 0.3498 - val_acc: 0.8395 Epoch 63/75 35/35 [==============================] - 1s 20ms/step - loss: 0.3961 - acc: 0.8303 - val_loss: 0.3787 - val_acc: 0.8328 Epoch 64/75 35/35 [==============================] - 1s 19ms/step - loss: 0.3633 - acc: 0.8435 - val_loss: 0.3482 - val_acc: 0.8514 Epoch 65/75 35/35 [==============================] - 1s 20ms/step - loss: 0.3583 - acc: 0.8442 - val_loss: 0.3574 - val_acc: 0.8414 Epoch 66/75 35/35 [==============================] - 1s 20ms/step - loss: 0.3620 - acc: 0.8387 - val_loss: 0.3318 - val_acc: 0.8536 Epoch 67/75 35/35 [==============================] - 1s 17ms/step - loss: 0.3414 - acc: 0.8456 - val_loss: 0.3361 - val_acc: 0.8465 Epoch 68/75 35/35 [==============================] - 1s 18ms/step - loss: 0.3357 - acc: 0.8466 - val_loss: 0.3145 - val_acc: 0.8582 Epoch 69/75 35/35 [==============================] - 1s 17ms/step - loss: 0.3409 - acc: 0.8504 - val_loss: 0.3112 - val_acc: 0.8651 Epoch 70/75 35/35 [==============================] - 1s 17ms/step - loss: 0.3293 - acc: 0.8589 - val_loss: 0.5264 - val_acc: 0.7521 Epoch 71/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3601 - acc: 0.8443 - val_loss: 0.3664 - val_acc: 0.8328 Epoch 72/75 35/35 [==============================] - 1s 16ms/step - loss: 0.3365 - acc: 0.8508 - val_loss: 0.3382 - val_acc: 0.8534 Epoch 73/75 35/35 [==============================] - 1s 16ms/step - loss: 0.3216 - acc: 0.8572 - val_loss: 0.3074 - val_acc: 0.8634 Epoch 74/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3262 - acc: 0.8568 - val_loss: 0.3277 - val_acc: 0.8579 Epoch 75/75 35/35 [==============================] - 0s 14ms/step - loss: 0.3174 - acc: 0.8621 - val_loss: 0.3288 - val_acc: 0.8560
print("Accuracy", round(model.evaluate(test,labels_test)[1]*100,2), "%")
810/810 [==============================] - 2s 3ms/step - loss: 0.3310 - acc: 0.8548 Accuracy 85.48 %
Of the three models, we continued with Debby's model. The validation accuracy converges at around 92%, this gives us the best rate.
seed = 1
np.random.seed(seed)
tf.random.set_seed(seed) # for TF this needs to be run per cell.
model = Sequential()
model.add(Dense(1000, input_dim=22, activation='relu'))
model.add(Dense(500, activation='relu'))
model.add(Dense(100, activation='relu'))
model.add(Dense(50, activation='relu'))
model.add(Dense(10, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
# Compile model
model.compile(loss='binary_crossentropy', optimizer="adam", metrics=['acc'])
# Fit the model, but this time store the history (that is accuracy and loss for each Epoch)
results = model.fit(train, labels_train, validation_data=(test, labels_test), epochs=100, batch_size=1000, verbose=1, shuffle=True)
# summarize history for loss
plot_acc_loss(results)
print("Accuracy", round(model.evaluate(test,labels_test)[1]*100,2), "%")
Epoch 1/100 104/104 [==============================] - 10s 8ms/step - loss: 1.7595 - acc: 0.5406 - val_loss: 0.7236 - val_acc: 0.5451 Epoch 2/100 104/104 [==============================] - 1s 6ms/step - loss: 0.6376 - acc: 0.6346 - val_loss: 0.5707 - val_acc: 0.6955 Epoch 3/100 104/104 [==============================] - 1s 5ms/step - loss: 0.6319 - acc: 0.6607 - val_loss: 0.5251 - val_acc: 0.7334 Epoch 4/100 104/104 [==============================] - 1s 5ms/step - loss: 0.5639 - acc: 0.7104 - val_loss: 0.5487 - val_acc: 0.7188 Epoch 5/100 104/104 [==============================] - 1s 6ms/step - loss: 0.5211 - acc: 0.7367 - val_loss: 0.5058 - val_acc: 0.7565 Epoch 6/100 104/104 [==============================] - 1s 5ms/step - loss: 0.5475 - acc: 0.7270 - val_loss: 0.4518 - val_acc: 0.7930 Epoch 7/100 104/104 [==============================] - 1s 5ms/step - loss: 0.5116 - acc: 0.7509 - val_loss: 0.4451 - val_acc: 0.7940 Epoch 8/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4779 - acc: 0.7750 - val_loss: 0.6379 - val_acc: 0.6937 Epoch 9/100 104/104 [==============================] - 1s 6ms/step - loss: 0.5010 - acc: 0.7604 - val_loss: 0.4250 - val_acc: 0.8159 Epoch 10/100 104/104 [==============================] - 1s 6ms/step - loss: 0.4669 - acc: 0.7835 - val_loss: 0.5779 - val_acc: 0.7266 Epoch 11/100 104/104 [==============================] - 1s 6ms/step - loss: 0.4533 - acc: 0.7933 - val_loss: 0.4242 - val_acc: 0.8074 Epoch 12/100 104/104 [==============================] - 1s 6ms/step - loss: 0.4447 - acc: 0.8006 - val_loss: 0.4302 - val_acc: 0.8138 Epoch 13/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4408 - acc: 0.8020 - val_loss: 0.4622 - val_acc: 0.7762 Epoch 14/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4277 - acc: 0.8106 - val_loss: 0.4078 - val_acc: 0.8208 Epoch 15/100 104/104 [==============================] - 1s 8ms/step - loss: 0.4414 - acc: 0.8024 - val_loss: 0.4244 - val_acc: 0.8081 Epoch 16/100 104/104 [==============================] - 1s 13ms/step - loss: 0.4211 - acc: 0.8173 - val_loss: 0.4194 - val_acc: 0.8096 Epoch 17/100 104/104 [==============================] - 1s 12ms/step - loss: 0.4544 - acc: 0.7976 - val_loss: 0.4192 - val_acc: 0.8080 Epoch 18/100 104/104 [==============================] - 1s 12ms/step - loss: 0.4218 - acc: 0.8136 - val_loss: 0.4081 - val_acc: 0.8281 Epoch 19/100 104/104 [==============================] - 1s 10ms/step - loss: 0.4335 - acc: 0.8063 - val_loss: 0.4754 - val_acc: 0.7678 Epoch 20/100 104/104 [==============================] - 1s 10ms/step - loss: 0.4087 - acc: 0.8222 - val_loss: 0.4004 - val_acc: 0.8219 Epoch 21/100 104/104 [==============================] - 1s 10ms/step - loss: 0.4088 - acc: 0.8209 - val_loss: 0.4055 - val_acc: 0.8298 Epoch 22/100 104/104 [==============================] - 1s 9ms/step - loss: 0.4026 - acc: 0.8251 - val_loss: 0.4424 - val_acc: 0.8037 Epoch 23/100 104/104 [==============================] - 1s 10ms/step - loss: 0.4025 - acc: 0.8251 - val_loss: 0.3881 - val_acc: 0.8379 Epoch 24/100 104/104 [==============================] - 1s 10ms/step - loss: 0.4041 - acc: 0.8234 - val_loss: 0.3894 - val_acc: 0.8353 Epoch 25/100 104/104 [==============================] - 1s 10ms/step - loss: 0.3935 - acc: 0.8277 - val_loss: 0.3635 - val_acc: 0.8460 Epoch 26/100 104/104 [==============================] - 1s 11ms/step - loss: 0.3937 - acc: 0.8291 - val_loss: 0.5957 - val_acc: 0.7130 Epoch 27/100 104/104 [==============================] - 1s 10ms/step - loss: 0.3857 - acc: 0.8321 - val_loss: 0.3622 - val_acc: 0.8421 Epoch 28/100 104/104 [==============================] - 1s 13ms/step - loss: 0.4764 - acc: 0.8084 - val_loss: 1.5105 - val_acc: 0.5516 Epoch 29/100 104/104 [==============================] - 1s 11ms/step - loss: 0.7779 - acc: 0.7452 - val_loss: 0.3690 - val_acc: 0.8432 Epoch 30/100 104/104 [==============================] - 1s 9ms/step - loss: 0.3735 - acc: 0.8381 - val_loss: 0.3760 - val_acc: 0.8345 Epoch 31/100 104/104 [==============================] - 1s 8ms/step - loss: 0.3693 - acc: 0.8384 - val_loss: 0.3518 - val_acc: 0.8511 Epoch 32/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3614 - acc: 0.8430 - val_loss: 0.3732 - val_acc: 0.8352 Epoch 33/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3441 - acc: 0.8523 - val_loss: 0.3368 - val_acc: 0.8575 Epoch 34/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3412 - acc: 0.8533 - val_loss: 0.3531 - val_acc: 0.8507 Epoch 35/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3458 - acc: 0.8509 - val_loss: 0.3455 - val_acc: 0.8513 Epoch 36/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3428 - acc: 0.8514 - val_loss: 0.3614 - val_acc: 0.8411 Epoch 37/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3244 - acc: 0.8601 - val_loss: 0.3098 - val_acc: 0.8673 Epoch 38/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3231 - acc: 0.8599 - val_loss: 0.3267 - val_acc: 0.8608 Epoch 39/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3200 - acc: 0.8610 - val_loss: 0.3257 - val_acc: 0.8603 Epoch 40/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3160 - acc: 0.8621 - val_loss: 0.3324 - val_acc: 0.8557 Epoch 41/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3158 - acc: 0.8633 - val_loss: 0.2965 - val_acc: 0.8738 Epoch 42/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3119 - acc: 0.8639 - val_loss: 0.3338 - val_acc: 0.8545 Epoch 43/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3027 - acc: 0.8696 - val_loss: 0.2939 - val_acc: 0.8753 Epoch 44/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2939 - acc: 0.8736 - val_loss: 0.3019 - val_acc: 0.8730 Epoch 45/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2959 - acc: 0.8720 - val_loss: 0.2896 - val_acc: 0.8765 Epoch 46/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2974 - acc: 0.8717 - val_loss: 0.2783 - val_acc: 0.8805 Epoch 47/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2976 - acc: 0.8706 - val_loss: 0.3530 - val_acc: 0.8408 Epoch 48/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2875 - acc: 0.8740 - val_loss: 0.2832 - val_acc: 0.8777 Epoch 49/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2798 - acc: 0.8786 - val_loss: 0.3283 - val_acc: 0.8574 Epoch 50/100 104/104 [==============================] - 1s 8ms/step - loss: 0.2737 - acc: 0.8813 - val_loss: 0.2731 - val_acc: 0.8791 Epoch 51/100 104/104 [==============================] - 1s 8ms/step - loss: 0.2688 - acc: 0.8835 - val_loss: 0.2534 - val_acc: 0.8899 Epoch 52/100 104/104 [==============================] - 1s 8ms/step - loss: 0.2622 - acc: 0.8868 - val_loss: 0.2524 - val_acc: 0.8928 Epoch 53/100 104/104 [==============================] - 1s 8ms/step - loss: 0.2666 - acc: 0.8852 - val_loss: 0.2612 - val_acc: 0.8838 Epoch 54/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2557 - acc: 0.8893 - val_loss: 0.2766 - val_acc: 0.8826 Epoch 55/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2553 - acc: 0.8892 - val_loss: 0.2379 - val_acc: 0.8959 Epoch 56/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2519 - acc: 0.8906 - val_loss: 0.2315 - val_acc: 0.9000 Epoch 57/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2570 - acc: 0.8886 - val_loss: 0.2575 - val_acc: 0.8923 Epoch 58/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2412 - acc: 0.8950 - val_loss: 0.3916 - val_acc: 0.8279 Epoch 59/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2597 - acc: 0.8873 - val_loss: 0.2501 - val_acc: 0.8893 Epoch 60/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2381 - acc: 0.8971 - val_loss: 0.2511 - val_acc: 0.8913 Epoch 61/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2389 - acc: 0.8960 - val_loss: 0.2232 - val_acc: 0.9014 Epoch 62/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2558 - acc: 0.8900 - val_loss: 0.2225 - val_acc: 0.9047 Epoch 63/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2542 - acc: 0.8904 - val_loss: 0.2191 - val_acc: 0.9068 Epoch 64/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2289 - acc: 0.9005 - val_loss: 0.2295 - val_acc: 0.8984 Epoch 65/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2284 - acc: 0.9006 - val_loss: 0.2382 - val_acc: 0.8951 Epoch 66/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2262 - acc: 0.9021 - val_loss: 0.2363 - val_acc: 0.8986 Epoch 67/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2243 - acc: 0.9018 - val_loss: 0.2815 - val_acc: 0.8778 Epoch 68/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2376 - acc: 0.8958 - val_loss: 0.2128 - val_acc: 0.9075 Epoch 69/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2194 - acc: 0.9039 - val_loss: 0.2056 - val_acc: 0.9106 Epoch 70/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2177 - acc: 0.9047 - val_loss: 0.2038 - val_acc: 0.9115 Epoch 71/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2189 - acc: 0.9039 - val_loss: 0.2082 - val_acc: 0.9131 Epoch 72/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2153 - acc: 0.9056 - val_loss: 0.1973 - val_acc: 0.9138 Epoch 73/100 104/104 [==============================] - 1s 8ms/step - loss: 0.2091 - acc: 0.9090 - val_loss: 0.2118 - val_acc: 0.9077 Epoch 74/100 104/104 [==============================] - 1s 8ms/step - loss: 0.2112 - acc: 0.9070 - val_loss: 0.1993 - val_acc: 0.9122 Epoch 75/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2176 - acc: 0.9049 - val_loss: 0.2878 - val_acc: 0.8696 Epoch 76/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2184 - acc: 0.9045 - val_loss: 0.2032 - val_acc: 0.9124 Epoch 77/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2043 - acc: 0.9103 - val_loss: 0.1980 - val_acc: 0.9130 Epoch 78/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2191 - acc: 0.9037 - val_loss: 0.2052 - val_acc: 0.9101 Epoch 79/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2051 - acc: 0.9102 - val_loss: 0.2048 - val_acc: 0.9129 Epoch 80/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2040 - acc: 0.9099 - val_loss: 0.1994 - val_acc: 0.9124 Epoch 81/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2058 - acc: 0.9095 - val_loss: 0.2023 - val_acc: 0.9109 Epoch 82/100 104/104 [==============================] - 1s 5ms/step - loss: 0.1995 - acc: 0.9117 - val_loss: 0.1860 - val_acc: 0.9198 Epoch 83/100 104/104 [==============================] - 1s 6ms/step - loss: 0.1967 - acc: 0.9133 - val_loss: 0.1840 - val_acc: 0.9203 Epoch 84/100 104/104 [==============================] - 1s 6ms/step - loss: 0.1962 - acc: 0.9131 - val_loss: 0.2147 - val_acc: 0.9034 Epoch 85/100 104/104 [==============================] - 1s 5ms/step - loss: 0.1999 - acc: 0.9115 - val_loss: 0.1899 - val_acc: 0.9147 Epoch 86/100 104/104 [==============================] - 1s 5ms/step - loss: 0.1995 - acc: 0.9121 - val_loss: 0.1883 - val_acc: 0.9207 Epoch 87/100 104/104 [==============================] - 1s 9ms/step - loss: 0.1917 - acc: 0.9162 - val_loss: 0.1854 - val_acc: 0.9212 Epoch 88/100 104/104 [==============================] - 1s 8ms/step - loss: 0.1873 - acc: 0.9179 - val_loss: 0.2008 - val_acc: 0.9133 Epoch 89/100 104/104 [==============================] - 1s 9ms/step - loss: 0.1919 - acc: 0.9162 - val_loss: 0.1786 - val_acc: 0.9215 Epoch 90/100 104/104 [==============================] - 2s 16ms/step - loss: 0.1961 - acc: 0.9143 - val_loss: 0.1788 - val_acc: 0.9260 Epoch 91/100 104/104 [==============================] - 1s 9ms/step - loss: 0.1838 - acc: 0.9201 - val_loss: 0.1736 - val_acc: 0.9243 Epoch 92/100 104/104 [==============================] - 1s 8ms/step - loss: 0.1845 - acc: 0.9196 - val_loss: 0.1782 - val_acc: 0.9223 Epoch 93/100 104/104 [==============================] - 1s 6ms/step - loss: 0.1914 - acc: 0.9172 - val_loss: 0.2126 - val_acc: 0.9115 Epoch 94/100 104/104 [==============================] - 1s 6ms/step - loss: 0.1859 - acc: 0.9198 - val_loss: 0.1778 - val_acc: 0.9255 Epoch 95/100 104/104 [==============================] - 1s 6ms/step - loss: 0.1730 - acc: 0.9240 - val_loss: 0.1713 - val_acc: 0.9287 Epoch 96/100 104/104 [==============================] - 1s 5ms/step - loss: 0.1691 - acc: 0.9266 - val_loss: 0.1702 - val_acc: 0.9274 Epoch 97/100 104/104 [==============================] - 1s 6ms/step - loss: 0.1800 - acc: 0.9218 - val_loss: 0.2132 - val_acc: 0.9117 Epoch 98/100 104/104 [==============================] - 1s 5ms/step - loss: 0.1850 - acc: 0.9196 - val_loss: 0.1695 - val_acc: 0.9275 Epoch 99/100 104/104 [==============================] - 1s 6ms/step - loss: 0.1701 - acc: 0.9257 - val_loss: 0.1642 - val_acc: 0.9319 Epoch 100/100 104/104 [==============================] - 1s 5ms/step - loss: 0.1772 - acc: 0.9234 - val_loss: 0.1872 - val_acc: 0.9181
810/810 [==============================] - 2s 2ms/step - loss: 0.1872 - acc: 0.9181 Accuracy 91.81 %
In this section, we are exploring the concept of the "Glassbox" approach, which aims to balance model accuracy and explainability. This approach involves using a transparent and interpretable model to achieve a trade-off between understanding how predictions are made and achieving a high level of accuracy.
We use a Decision Tree classifier:
model_dt = DecisionTreeClassifier()
model_dt.fit(train, labels_train)
accuracy = model_dt.score(test, labels_test)
print("Accuracy:", round(accuracy * 100, 2), "%")
Accuracy: 94.18 %
# Visualise the tree
text_representation = tree.export_text(model_dt,
feature_names = feature_names)
print(text_representation)
|--- Inflight entertainment <= 3.50 | |--- Seat comfort <= 3.50 | | |--- Seat comfort <= 0.50 | | | |--- Ease of Online booking <= 0.50 | | | | |--- class: 0 | | | |--- Ease of Online booking > 0.50 | | | | |--- class: 1 | | |--- Seat comfort > 0.50 | | | |--- Class <= 0.50 | | | | |--- Ease of Online booking <= 3.50 | | | | | |--- Online boarding <= 4.50 | | | | | | |--- Gate location <= 3.50 | | | | | | | |--- Checkin service <= 4.50 | | | | | | | | |--- Online support <= 4.50 | | | | | | | | | |--- Cleanliness <= 4.50 | | | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 25 | | | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | | | |--- Cleanliness > 4.50 | | | | | | | | | | |--- Customer Type <= 0.50 | | | | | | | | | | | |--- truncated branch of depth 10 | | | | | | | | | | |--- Customer Type > 0.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | |--- Online support > 4.50 | | | | | | | | | |--- Customer Type <= 0.50 | | | | | | | | | | |--- Age <= 37.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Age > 37.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | |--- Customer Type > 0.50 | | | | | | | | | | |--- Type of Travel <= 0.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Type of Travel > 0.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | |--- Checkin service > 4.50 | | | | | | | | |--- Customer Type <= 0.50 | | | | | | | | | |--- Age <= 37.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Age > 37.50 | | | | | | | | | | |--- Cleanliness <= 1.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Cleanliness > 1.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | | | | |--- Customer Type > 0.50 | | | | | | | | | |--- Type of Travel <= 0.50 | | | | | | | | | | |--- Gender <= 0.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Gender > 0.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Type of Travel > 0.50 | | | | | | | | | | |--- On-board service <= 1.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- On-board service > 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | |--- Gate location > 3.50 | | | | | | | |--- Flight Distance <= 6294.00 | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | |--- Online support <= 4.50 | | | | | | | | | | |--- On-board service <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | | | | | | |--- On-board service > 4.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | |--- Online support > 4.50 | | | | | | | | | | |--- Food and drink <= 4.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Food and drink > 4.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | |--- Food and drink <= 4.50 | | | | | | | | | | |--- Arrival Delay in Minutes <= 195.00 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | | | | |--- Arrival Delay in Minutes > 195.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Food and drink > 4.50 | | | | | | | | | | |--- class: 1 | | | | | | | |--- Flight Distance > 6294.00 | | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | | |--- class: 0 | | | | | | | | |--- Food and drink > 3.50 | | | | | | | | | |--- class: 1 | | | | | |--- Online boarding > 4.50 | | | | | | |--- Type of Travel <= 0.50 | | | | | | | |--- Gender <= 0.50 | | | | | | | | |--- class: 1 | | | | | | | |--- Gender > 0.50 | | | | | | | | |--- class: 0 | | | | | | |--- Type of Travel > 0.50 | | | | | | | |--- Departure Delay in Minutes <= 100.50 | | | | | | | | |--- Flight Distance <= 3908.50 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Flight Distance > 3908.50 | | | | | | | | | |--- class: 0 | | | | | | | |--- Departure Delay in Minutes > 100.50 | | | | | | | | |--- class: 0 | | | | |--- Ease of Online booking > 3.50 | | | | | |--- Customer Type <= 0.50 | | | | | | |--- Age <= 36.50 | | | | | | | |--- class: 0 | | | | | | |--- Age > 36.50 | | | | | | | |--- Seat comfort <= 1.50 | | | | | | | | |--- class: 0 | | | | | | | |--- Seat comfort > 1.50 | | | | | | | | |--- Flight Distance <= 2512.50 | | | | | | | | | |--- Inflight wifi service <= 1.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Inflight wifi service > 1.50 | | | | | | | | | | |--- Flight Distance <= 2505.00 | | | | | | | | | | | |--- truncated branch of depth 22 | | | | | | | | | | |--- Flight Distance > 2505.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Flight Distance > 2512.50 | | | | | | | | | |--- Online support <= 2.50 | | | | | | | | | | |--- Checkin service <= 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Checkin service > 3.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Online support > 2.50 | | | | | | | | | | |--- Age <= 56.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Age > 56.00 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | |--- Customer Type > 0.50 | | | | | | |--- Leg room service <= 3.50 | | | | | | | |--- Type of Travel <= 0.50 | | | | | | | | |--- Gender <= 0.50 | | | | | | | | | |--- Departure/Arrival time convenient <= 3.00 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Departure/Arrival time convenient > 3.00 | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Gender > 0.50 | | | | | | | | | |--- class: 0 | | | | | | | |--- Type of Travel > 0.50 | | | | | | | | |--- Baggage handling <= 3.50 | | | | | | | | | |--- Flight Distance <= 4414.00 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Flight Distance > 4414.00 | | | | | | | | | | |--- Flight Distance <= 5204.00 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Flight Distance > 5204.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Baggage handling > 3.50 | | | | | | | | | |--- Food and drink <= 0.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Food and drink > 0.50 | | | | | | | | | | |--- Departure/Arrival time convenient <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | | |--- Departure/Arrival time convenient > 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | |--- Leg room service > 3.50 | | | | | | | |--- Gate location <= 3.50 | | | | | | | | |--- Age <= 32.50 | | | | | | | | | |--- Gender <= 0.50 | | | | | | | | | | |--- Arrival Delay in Minutes <= 139.00 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | | |--- Arrival Delay in Minutes > 139.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Gender > 0.50 | | | | | | | | | | |--- Food and drink <= 4.00 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Food and drink > 4.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Age > 32.50 | | | | | | | | | |--- Baggage handling <= 2.50 | | | | | | | | | | |--- Leg room service <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Leg room service > 4.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Baggage handling > 2.50 | | | | | | | | | | |--- Cleanliness <= 2.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Cleanliness > 2.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | |--- Gate location > 3.50 | | | | | | | | |--- class: 0 | | | |--- Class > 0.50 | | | | |--- Gender <= 0.50 | | | | | |--- Type of Travel <= 0.50 | | | | | | |--- Departure/Arrival time convenient <= 3.50 | | | | | | | |--- Arrival Delay in Minutes <= 115.00 | | | | | | | | |--- Customer Type <= 0.50 | | | | | | | | | |--- class: 0 | | | | | | | | |--- Customer Type > 0.50 | | | | | | | | | |--- Flight Distance <= 5588.00 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Flight Distance > 5588.00 | | | | | | | | | | |--- class: 0 | | | | | | | |--- Arrival Delay in Minutes > 115.00 | | | | | | | | |--- Arrival Delay in Minutes <= 127.50 | | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Arrival Delay in Minutes > 127.50 | | | | | | | | | |--- class: 0 | | | | | | |--- Departure/Arrival time convenient > 3.50 | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | |--- Flight Distance <= 359.00 | | | | | | | | | |--- Gate location <= 3.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Gate location > 3.50 | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Flight Distance > 359.00 | | | | | | | | | |--- Gate location <= 3.50 | | | | | | | | | | |--- Flight Distance <= 1013.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Flight Distance > 1013.00 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | |--- Gate location > 3.50 | | | | | | | | | | |--- Inflight entertainment <= 1.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Inflight entertainment > 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | |--- Food and drink > 3.50 | | | | | | | | |--- Gate location <= 3.50 | | | | | | | | | |--- class: 0 | | | | | | | | |--- Gate location > 3.50 | | | | | | | | | |--- Ease of Online booking <= 3.50 | | | | | | | | | | |--- Online boarding <= 1.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Online boarding > 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Ease of Online booking > 3.50 | | | | | | | | | | |--- Inflight entertainment <= 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Inflight entertainment > 1.50 | | | | | | | | | | | |--- class: 0 | | | | | |--- Type of Travel > 0.50 | | | | | | |--- Customer Type <= 0.50 | | | | | | | |--- Flight Distance <= 2285.50 | | | | | | | | |--- Flight Distance <= 2111.50 | | | | | | | | | |--- Age <= 16.50 | | | | | | | | | | |--- On-board service <= 4.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- On-board service > 4.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Age > 16.50 | | | | | | | | | | |--- Class <= 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Class > 1.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | |--- Flight Distance > 2111.50 | | | | | | | | | |--- Flight Distance <= 2112.50 | | | | | | | | | | |--- Inflight wifi service <= 3.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Inflight wifi service > 3.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Flight Distance > 2112.50 | | | | | | | | | | |--- Age <= 22.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Age > 22.50 | | | | | | | | | | | |--- class: 0 | | | | | | | |--- Flight Distance > 2285.50 | | | | | | | | |--- Cleanliness <= 4.50 | | | | | | | | | |--- Gate location <= 2.50 | | | | | | | | | | |--- Age <= 28.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | | | | | | |--- Age > 28.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Gate location > 2.50 | | | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | |--- Cleanliness > 4.50 | | | | | | | | | |--- Departure Delay in Minutes <= 1.50 | | | | | | | | | | |--- Flight Distance <= 3119.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Flight Distance > 3119.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Departure Delay in Minutes > 1.50 | | | | | | | | | | |--- Arrival Delay in Minutes <= 0.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | | |--- Arrival Delay in Minutes > 0.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | |--- Customer Type > 0.50 | | | | | | | |--- Checkin service <= 4.50 | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | |--- Online support <= 4.50 | | | | | | | | | | |--- Online boarding <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 24 | | | | | | | | | | |--- Online boarding > 4.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Online support > 4.50 | | | | | | | | | | |--- Ease of Online booking <= 4.00 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Ease of Online booking > 4.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | |--- Flight Distance <= 808.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Flight Distance > 808.50 | | | | | | | | | | |--- class: 1 | | | | | | | |--- Checkin service > 4.50 | | | | | | | | |--- Flight Distance <= 2348.50 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Flight Distance > 2348.50 | | | | | | | | | |--- Flight Distance <= 2911.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Flight Distance > 2911.50 | | | | | | | | | | |--- class: 1 | | | | |--- Gender > 0.50 | | | | | |--- Type of Travel <= 0.50 | | | | | | |--- class: 0 | | | | | |--- Type of Travel > 0.50 | | | | | | |--- Customer Type <= 0.50 | | | | | | | |--- Cleanliness <= 4.50 | | | | | | | | |--- Arrival Delay in Minutes <= 238.50 | | | | | | | | | |--- On-board service <= 4.50 | | | | | | | | | | |--- Gate location <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Gate location > 4.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | |--- On-board service > 4.50 | | | | | | | | | | |--- Gate location <= 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Gate location > 3.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | | |--- Arrival Delay in Minutes > 238.50 | | | | | | | | | |--- Flight Distance <= 2948.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Flight Distance > 2948.50 | | | | | | | | | | |--- class: 1 | | | | | | | |--- Cleanliness > 4.50 | | | | | | | | |--- Flight Distance <= 2501.00 | | | | | | | | | |--- Departure Delay in Minutes <= 11.50 | | | | | | | | | | |--- Flight Distance <= 2342.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Flight Distance > 2342.00 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Departure Delay in Minutes > 11.50 | | | | | | | | | | |--- Online support <= 1.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | | |--- Online support > 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Flight Distance > 2501.00 | | | | | | | | | |--- Flight Distance <= 2503.00 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Flight Distance > 2503.00 | | | | | | | | | | |--- Online support <= 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Online support > 3.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | |--- Customer Type > 0.50 | | | | | | | |--- Checkin service <= 4.50 | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | |--- Cleanliness <= 4.50 | | | | | | | | | | |--- On-board service <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 22 | | | | | | | | | | |--- On-board service > 4.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | |--- Cleanliness > 4.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | |--- class: 1 | | | | | | | |--- Checkin service > 4.50 | | | | | | | | |--- class: 1 | |--- Seat comfort > 3.50 | | |--- Seat comfort <= 4.50 | | | |--- Gate location <= 3.50 | | | | |--- Class <= 0.50 | | | | | |--- Customer Type <= 0.50 | | | | | | |--- Age <= 24.50 | | | | | | | |--- Cleanliness <= 2.50 | | | | | | | | |--- class: 0 | | | | | | | |--- Cleanliness > 2.50 | | | | | | | | |--- On-board service <= 2.50 | | | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Food and drink > 3.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- On-board service > 2.50 | | | | | | | | | |--- class: 1 | | | | | | |--- Age > 24.50 | | | | | | | |--- Arrival Delay in Minutes <= 5.50 | | | | | | | | |--- Arrival Delay in Minutes <= 0.50 | | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | | |--- Checkin service <= 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Checkin service > 1.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | | |--- Flight Distance <= 1914.00 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Flight Distance > 1914.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Arrival Delay in Minutes > 0.50 | | | | | | | | | |--- class: 1 | | | | | | | |--- Arrival Delay in Minutes > 5.50 | | | | | | | | |--- Departure Delay in Minutes <= 177.50 | | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | | |--- Inflight wifi service <= 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Inflight wifi service > 1.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | |--- Departure Delay in Minutes > 177.50 | | | | | | | | | |--- class: 1 | | | | | |--- Customer Type > 0.50 | | | | | | |--- Type of Travel <= 0.50 | | | | | | | |--- On-board service <= 3.50 | | | | | | | | |--- Leg room service <= 3.50 | | | | | | | | | |--- Gender <= 0.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Gender > 0.50 | | | | | | | | | | |--- Departure/Arrival time convenient <= 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Departure/Arrival time convenient > 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Leg room service > 3.50 | | | | | | | | | |--- Online support <= 1.50 | | | | | | | | | | |--- Baggage handling <= 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Baggage handling > 1.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Online support > 1.50 | | | | | | | | | | |--- Age <= 10.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Age > 10.00 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | |--- On-board service > 3.50 | | | | | | | | |--- Baggage handling <= 3.50 | | | | | | | | | |--- class: 0 | | | | | | | | |--- Baggage handling > 3.50 | | | | | | | | | |--- Departure/Arrival time convenient <= 2.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Departure/Arrival time convenient > 2.50 | | | | | | | | | | |--- Flight Distance <= 435.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Flight Distance > 435.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | |--- Type of Travel > 0.50 | | | | | | | |--- class: 0 | | | | |--- Class > 0.50 | | | | | |--- Cleanliness <= 3.50 | | | | | | |--- Inflight entertainment <= 2.50 | | | | | | | |--- Cleanliness <= 1.50 | | | | | | | | |--- Age <= 19.50 | | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Age > 19.50 | | | | | | | | | |--- Flight Distance <= 262.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Flight Distance > 262.50 | | | | | | | | | | |--- Age <= 64.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Age > 64.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | |--- Cleanliness > 1.50 | | | | | | | | |--- Gender <= 0.50 | | | | | | | | | |--- Checkin service <= 4.50 | | | | | | | | | | |--- Leg room service <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 11 | | | | | | | | | | |--- Leg room service > 4.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Checkin service > 4.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Gender > 0.50 | | | | | | | | | |--- Gate location <= 1.50 | | | | | | | | | | |--- Age <= 28.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Age > 28.00 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Gate location > 1.50 | | | | | | | | | | |--- On-board service <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- On-board service > 4.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | |--- Inflight entertainment > 2.50 | | | | | | | |--- Online boarding <= 1.50 | | | | | | | | |--- Flight Distance <= 2055.00 | | | | | | | | | |--- Flight Distance <= 1739.50 | | | | | | | | | | |--- Flight Distance <= 1699.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Flight Distance > 1699.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Flight Distance > 1739.50 | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Flight Distance > 2055.00 | | | | | | | | | |--- Age <= 15.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Age > 15.50 | | | | | | | | | | |--- Arrival Delay in Minutes <= 8.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Arrival Delay in Minutes > 8.00 | | | | | | | | | | | |--- class: 0 | | | | | | | |--- Online boarding > 1.50 | | | | | | | | |--- Departure/Arrival time convenient <= 0.50 | | | | | | | | | |--- Baggage handling <= 2.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Baggage handling > 2.50 | | | | | | | | | | |--- Inflight wifi service <= 2.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Inflight wifi service > 2.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Departure/Arrival time convenient > 0.50 | | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | | |--- Flight Distance <= 353.00 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | | |--- Flight Distance > 353.00 | | | | | | | | | | | |--- truncated branch of depth 10 | | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | | |--- Departure Delay in Minutes <= 3.00 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Departure Delay in Minutes > 3.00 | | | | | | | | | | | |--- class: 0 | | | | | |--- Cleanliness > 3.50 | | | | | | |--- Departure/Arrival time convenient <= 3.50 | | | | | | | |--- Baggage handling <= 3.50 | | | | | | | | |--- Departure Delay in Minutes <= 111.50 | | | | | | | | | |--- Arrival Delay in Minutes <= 2.50 | | | | | | | | | | |--- Flight Distance <= 1582.00 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | | |--- Flight Distance > 1582.00 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | |--- Arrival Delay in Minutes > 2.50 | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Departure Delay in Minutes > 111.50 | | | | | | | | | |--- class: 1 | | | | | | | |--- Baggage handling > 3.50 | | | | | | | | |--- Online boarding <= 4.50 | | | | | | | | | |--- Inflight entertainment <= 2.50 | | | | | | | | | | |--- Inflight entertainment <= 0.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Inflight entertainment > 0.50 | | | | | | | | | | | |--- truncated branch of depth 10 | | | | | | | | | |--- Inflight entertainment > 2.50 | | | | | | | | | | |--- Online support <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | | | | | | |--- Online support > 2.50 | | | | | | | | | | | |--- truncated branch of depth 11 | | | | | | | | |--- Online boarding > 4.50 | | | | | | | | | |--- class: 1 | | | | | | |--- Departure/Arrival time convenient > 3.50 | | | | | | | |--- Arrival Delay in Minutes <= 6.50 | | | | | | | | |--- Ease of Online booking <= 2.50 | | | | | | | | | |--- Online support <= 3.50 | | | | | | | | | | |--- Leg room service <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | | |--- Leg room service > 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Online support > 3.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Ease of Online booking > 2.50 | | | | | | | | | |--- Flight Distance <= 2567.00 | | | | | | | | | | |--- Inflight wifi service <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Inflight wifi service > 3.50 | | | | | | | | | | | |--- truncated branch of depth 9 | | | | | | | | | |--- Flight Distance > 2567.00 | | | | | | | | | | |--- Flight Distance <= 3737.00 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Flight Distance > 3737.00 | | | | | | | | | | | |--- class: 0 | | | | | | | |--- Arrival Delay in Minutes > 6.50 | | | | | | | | |--- Flight Distance <= 612.50 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Flight Distance > 612.50 | | | | | | | | | |--- Customer Type <= 0.50 | | | | | | | | | | |--- Gate location <= 2.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Gate location > 2.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Customer Type > 0.50 | | | | | | | | | | |--- Age <= 7.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Age > 7.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | |--- Gate location > 3.50 | | | | |--- Departure/Arrival time convenient <= 4.50 | | | | | |--- Departure/Arrival time convenient <= 3.50 | | | | | | |--- Type of Travel <= 0.50 | | | | | | | |--- Inflight wifi service <= 4.50 | | | | | | | | |--- Food and drink <= 4.50 | | | | | | | | | |--- Age <= 29.50 | | | | | | | | | | |--- Gender <= 0.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | | |--- Gender > 0.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | |--- Age > 29.50 | | | | | | | | | | |--- Online boarding <= 1.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | | | | |--- Online boarding > 1.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | | |--- Food and drink > 4.50 | | | | | | | | | |--- Baggage handling <= 3.50 | | | | | | | | | | |--- Ease of Online booking <= 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Ease of Online booking > 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Baggage handling > 3.50 | | | | | | | | | | |--- class: 1 | | | | | | | |--- Inflight wifi service > 4.50 | | | | | | | | |--- Arrival Delay in Minutes <= 37.50 | | | | | | | | | |--- Class <= 0.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Class > 0.50 | | | | | | | | | | |--- Flight Distance <= 1526.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | | | | |--- Flight Distance > 1526.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Arrival Delay in Minutes > 37.50 | | | | | | | | | |--- class: 0 | | | | | | |--- Type of Travel > 0.50 | | | | | | | |--- Class <= 0.50 | | | | | | | | |--- Food and drink <= 4.50 | | | | | | | | | |--- On-board service <= 1.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- On-board service > 1.50 | | | | | | | | | | |--- On-board service <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- On-board service > 3.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | |--- Food and drink > 4.50 | | | | | | | | | |--- class: 0 | | | | | | | |--- Class > 0.50 | | | | | | | | |--- Customer Type <= 0.50 | | | | | | | | | |--- Checkin service <= 3.50 | | | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | |--- Checkin service > 3.50 | | | | | | | | | | |--- On-board service <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- On-board service > 3.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | |--- Customer Type > 0.50 | | | | | | | | | |--- Arrival Delay in Minutes <= 61.50 | | | | | | | | | | |--- Flight Distance <= 2024.00 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Flight Distance > 2024.00 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Arrival Delay in Minutes > 61.50 | | | | | | | | | | |--- class: 0 | | | | | |--- Departure/Arrival time convenient > 3.50 | | | | | | |--- Ease of Online booking <= 1.50 | | | | | | | |--- Inflight wifi service <= 3.50 | | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | | |--- Age <= 51.00 | | | | | | | | | | |--- Online support <= 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Online support > 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Age > 51.00 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Food and drink > 3.50 | | | | | | | | | |--- Leg room service <= 1.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Leg room service > 1.50 | | | | | | | | | | |--- Flight Distance <= 1447.00 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Flight Distance > 1447.00 | | | | | | | | | | | |--- class: 1 | | | | | | | |--- Inflight wifi service > 3.50 | | | | | | | | |--- Arrival Delay in Minutes <= 141.00 | | | | | | | | | |--- class: 0 | | | | | | | | |--- Arrival Delay in Minutes > 141.00 | | | | | | | | | |--- class: 1 | | | | | | |--- Ease of Online booking > 1.50 | | | | | | | |--- Cleanliness <= 4.50 | | | | | | | | |--- Inflight wifi service <= 3.50 | | | | | | | | | |--- Inflight entertainment <= 2.50 | | | | | | | | | | |--- Gate location <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 15 | | | | | | | | | | |--- Gate location > 4.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Inflight entertainment > 2.50 | | | | | | | | | | |--- Age <= 35.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | | |--- Age > 35.50 | | | | | | | | | | | |--- truncated branch of depth 21 | | | | | | | | |--- Inflight wifi service > 3.50 | | | | | | | | | |--- Checkin service <= 4.50 | | | | | | | | | | |--- Leg room service <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Leg room service > 3.50 | | | | | | | | | | | |--- truncated branch of depth 13 | | | | | | | | | |--- Checkin service > 4.50 | | | | | | | | | | |--- On-board service <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- On-board service > 4.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | |--- Cleanliness > 4.50 | | | | | | | | |--- Gate location <= 4.50 | | | | | | | | | |--- Leg room service <= 4.50 | | | | | | | | | | |--- Class <= 0.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Class > 0.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | |--- Leg room service > 4.50 | | | | | | | | | | |--- Departure Delay in Minutes <= 130.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Departure Delay in Minutes > 130.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Gate location > 4.50 | | | | | | | | | |--- Arrival Delay in Minutes <= 1.00 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Arrival Delay in Minutes > 1.00 | | | | | | | | | | |--- class: 0 | | | | |--- Departure/Arrival time convenient > 4.50 | | | | | |--- Class <= 0.50 | | | | | | |--- Gate location <= 4.50 | | | | | | | |--- Type of Travel <= 0.50 | | | | | | | | |--- Age <= 40.00 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Age > 40.00 | | | | | | | | | |--- class: 0 | | | | | | | |--- Type of Travel > 0.50 | | | | | | | | |--- Online support <= 3.50 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Online support > 3.50 | | | | | | | | | |--- On-board service <= 3.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- On-board service > 3.50 | | | | | | | | | | |--- Inflight wifi service <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Inflight wifi service > 2.50 | | | | | | | | | | | |--- class: 1 | | | | | | |--- Gate location > 4.50 | | | | | | | |--- Checkin service <= 4.50 | | | | | | | | |--- Type of Travel <= 0.50 | | | | | | | | | |--- Leg room service <= 3.00 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Leg room service > 3.00 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Type of Travel > 0.50 | | | | | | | | | |--- Departure Delay in Minutes <= 207.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Departure Delay in Minutes > 207.50 | | | | | | | | | | |--- class: 1 | | | | | | | |--- Checkin service > 4.50 | | | | | | | | |--- class: 1 | | | | | |--- Class > 0.50 | | | | | | |--- Food and drink <= 4.50 | | | | | | | |--- Age <= 54.50 | | | | | | | | |--- Departure Delay in Minutes <= 4.50 | | | | | | | | | |--- Food and drink <= 2.50 | | | | | | | | | | |--- On-board service <= 2.00 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- On-board service > 2.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Food and drink > 2.50 | | | | | | | | | | |--- Online boarding <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | | |--- Online boarding > 3.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | |--- Departure Delay in Minutes > 4.50 | | | | | | | | | |--- Leg room service <= 3.50 | | | | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Food and drink > 3.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Leg room service > 3.50 | | | | | | | | | | |--- class: 0 | | | | | | | |--- Age > 54.50 | | | | | | | | |--- Flight Distance <= 1708.00 | | | | | | | | | |--- Flight Distance <= 658.50 | | | | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Food and drink > 3.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Flight Distance > 658.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Flight Distance > 1708.00 | | | | | | | | | |--- class: 0 | | | | | | |--- Food and drink > 4.50 | | | | | | | |--- Inflight entertainment <= 2.50 | | | | | | | | |--- On-board service <= 2.50 | | | | | | | | | |--- class: 0 | | | | | | | | |--- On-board service > 2.50 | | | | | | | | | |--- Online support <= 3.50 | | | | | | | | | | |--- Age <= 59.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | | | | | | |--- Age > 59.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Online support > 3.50 | | | | | | | | | | |--- class: 1 | | | | | | | |--- Inflight entertainment > 2.50 | | | | | | | | |--- Type of Travel <= 0.50 | | | | | | | | | |--- Leg room service <= 4.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Leg room service > 4.50 | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Type of Travel > 0.50 | | | | | | | | | |--- Online boarding <= 4.50 | | | | | | | | | | |--- Online support <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | | | | | | |--- Online support > 4.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Online boarding > 4.50 | | | | | | | | | | |--- class: 1 | | |--- Seat comfort > 4.50 | | | |--- Leg room service <= 4.50 | | | | |--- Ease of Online booking <= 4.50 | | | | | |--- Cleanliness <= 1.50 | | | | | | |--- Online boarding <= 1.50 | | | | | | | |--- Arrival Delay in Minutes <= 5.00 | | | | | | | | |--- class: 0 | | | | | | | |--- Arrival Delay in Minutes > 5.00 | | | | | | | | |--- class: 1 | | | | | | |--- Online boarding > 1.50 | | | | | | | |--- class: 1 | | | | | |--- Cleanliness > 1.50 | | | | | | |--- Departure Delay in Minutes <= 174.50 | | | | | | | |--- class: 1 | | | | | | |--- Departure Delay in Minutes > 174.50 | | | | | | | |--- Arrival Delay in Minutes <= 178.50 | | | | | | | | |--- Online support <= 4.00 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Online support > 4.00 | | | | | | | | | |--- class: 0 | | | | | | | |--- Arrival Delay in Minutes > 178.50 | | | | | | | | |--- class: 1 | | | | |--- Ease of Online booking > 4.50 | | | | | |--- Class <= 0.50 | | | | | | |--- Gate location <= 4.50 | | | | | | | |--- Customer Type <= 0.50 | | | | | | | | |--- class: 1 | | | | | | | |--- Customer Type > 0.50 | | | | | | | | |--- Age <= 28.50 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Age > 28.50 | | | | | | | | | |--- class: 0 | | | | | | |--- Gate location > 4.50 | | | | | | | |--- Age <= 59.50 | | | | | | | | |--- Checkin service <= 1.50 | | | | | | | | | |--- Arrival Delay in Minutes <= 12.00 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Arrival Delay in Minutes > 12.00 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Checkin service > 1.50 | | | | | | | | | |--- Inflight wifi service <= 3.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Inflight wifi service > 3.50 | | | | | | | | | | |--- Age <= 54.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Age > 54.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | |--- Age > 59.50 | | | | | | | | |--- class: 0 | | | | | |--- Class > 0.50 | | | | | | |--- class: 1 | | | |--- Leg room service > 4.50 | | | | |--- class: 1 |--- Inflight entertainment > 3.50 | |--- Ease of Online booking <= 3.50 | | |--- Inflight entertainment <= 4.50 | | | |--- Online support <= 4.50 | | | | |--- Seat comfort <= 4.50 | | | | | |--- Checkin service <= 2.50 | | | | | | |--- Seat comfort <= 3.50 | | | | | | | |--- Seat comfort <= 0.50 | | | | | | | | |--- class: 1 | | | | | | | |--- Seat comfort > 0.50 | | | | | | | | |--- Leg room service <= 3.50 | | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | | |--- Online boarding <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 15 | | | | | | | | | | |--- Online boarding > 4.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | | |--- Online support <= 2.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Online support > 2.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | |--- Leg room service > 3.50 | | | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | | | |--- Arrival Delay in Minutes <= 116.00 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Arrival Delay in Minutes > 116.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Food and drink > 3.50 | | | | | | | | | | |--- Food and drink <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Food and drink > 4.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | |--- Seat comfort > 3.50 | | | | | | | |--- Gate location <= 2.50 | | | | | | | | |--- Leg room service <= 3.50 | | | | | | | | | |--- Cleanliness <= 3.50 | | | | | | | | | | |--- Age <= 33.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Age > 33.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | |--- Cleanliness > 3.50 | | | | | | | | | | |--- Gate location <= 1.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | | |--- Gate location > 1.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | |--- Leg room service > 3.50 | | | | | | | | | |--- Departure/Arrival time convenient <= 1.50 | | | | | | | | | | |--- Gender <= 0.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Gender > 0.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | |--- Departure/Arrival time convenient > 1.50 | | | | | | | | | | |--- Age <= 26.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | | |--- Age > 26.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | |--- Gate location > 2.50 | | | | | | | | |--- Customer Type <= 0.50 | | | | | | | | | |--- On-board service <= 4.50 | | | | | | | | | | |--- Departure/Arrival time convenient <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 13 | | | | | | | | | | |--- Departure/Arrival time convenient > 4.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- On-board service > 4.50 | | | | | | | | | | |--- Flight Distance <= 1542.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Flight Distance > 1542.00 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | |--- Customer Type > 0.50 | | | | | | | | | |--- Type of Travel <= 0.50 | | | | | | | | | | |--- Gate location <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 17 | | | | | | | | | | |--- Gate location > 4.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Type of Travel > 0.50 | | | | | | | | | | |--- Ease of Online booking <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Ease of Online booking > 2.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | |--- Checkin service > 2.50 | | | | | | |--- Seat comfort <= 0.50 | | | | | | | |--- class: 1 | | | | | | |--- Seat comfort > 0.50 | | | | | | | |--- Online boarding <= 2.50 | | | | | | | | |--- Seat comfort <= 3.50 | | | | | | | | | |--- Checkin service <= 4.50 | | | | | | | | | | |--- Online support <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | | |--- Online support > 2.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | | | | | |--- Checkin service > 4.50 | | | | | | | | | | |--- Ease of Online booking <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Ease of Online booking > 2.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Seat comfort > 3.50 | | | | | | | | | |--- Class <= 0.50 | | | | | | | | | | |--- Age <= 24.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | | | | | | |--- Age > 24.50 | | | | | | | | | | | |--- truncated branch of depth 19 | | | | | | | | | |--- Class > 0.50 | | | | | | | | | | |--- Arrival Delay in Minutes <= 0.50 | | | | | | | | | | | |--- truncated branch of depth 23 | | | | | | | | | | |--- Arrival Delay in Minutes > 0.50 | | | | | | | | | | | |--- truncated branch of depth 13 | | | | | | | |--- Online boarding > 2.50 | | | | | | | | |--- Class <= 0.50 | | | | | | | | | |--- Leg room service <= 1.50 | | | | | | | | | | |--- Age <= 31.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | | |--- Age > 31.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | |--- Leg room service > 1.50 | | | | | | | | | | |--- Departure/Arrival time convenient <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 22 | | | | | | | | | | |--- Departure/Arrival time convenient > 4.50 | | | | | | | | | | | |--- truncated branch of depth 9 | | | | | | | | |--- Class > 0.50 | | | | | | | | | |--- Food and drink <= 2.50 | | | | | | | | | | |--- Inflight wifi service <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Inflight wifi service > 2.50 | | | | | | | | | | | |--- truncated branch of depth 10 | | | | | | | | | |--- Food and drink > 2.50 | | | | | | | | | | |--- Food and drink <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 21 | | | | | | | | | | |--- Food and drink > 4.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | |--- Seat comfort > 4.50 | | | | | |--- class: 1 | | | |--- Online support > 4.50 | | | | |--- Type of Travel <= 0.50 | | | | | |--- Gender <= 0.50 | | | | | | |--- Seat comfort <= 2.50 | | | | | | | |--- Departure Delay in Minutes <= 145.50 | | | | | | | | |--- class: 1 | | | | | | | |--- Departure Delay in Minutes > 145.50 | | | | | | | | |--- class: 0 | | | | | | |--- Seat comfort > 2.50 | | | | | | | |--- Seat comfort <= 4.50 | | | | | | | | |--- Departure/Arrival time convenient <= 4.50 | | | | | | | | | |--- Gate location <= 2.50 | | | | | | | | | | |--- Gate location <= 1.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Gate location > 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Gate location > 2.50 | | | | | | | | | | |--- Leg room service <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 9 | | | | | | | | | | |--- Leg room service > 4.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Departure/Arrival time convenient > 4.50 | | | | | | | | | |--- Class <= 0.50 | | | | | | | | | | |--- Leg room service <= 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Leg room service > 3.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Class > 0.50 | | | | | | | | | | |--- Departure Delay in Minutes <= 9.00 | | | | | | | | | | | |--- truncated branch of depth 10 | | | | | | | | | | |--- Departure Delay in Minutes > 9.00 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | |--- Seat comfort > 4.50 | | | | | | | | |--- class: 1 | | | | | |--- Gender > 0.50 | | | | | | |--- Seat comfort <= 4.50 | | | | | | | |--- Food and drink <= 0.50 | | | | | | | | |--- class: 1 | | | | | | | |--- Food and drink > 0.50 | | | | | | | | |--- Cleanliness <= 4.50 | | | | | | | | | |--- On-board service <= 4.50 | | | | | | | | | | |--- Checkin service <= 1.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Checkin service > 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- On-board service > 4.50 | | | | | | | | | | |--- Ease of Online booking <= 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Ease of Online booking > 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Cleanliness > 4.50 | | | | | | | | | |--- Age <= 27.00 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Age > 27.00 | | | | | | | | | | |--- Ease of Online booking <= 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Ease of Online booking > 1.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | |--- Seat comfort > 4.50 | | | | | | | |--- class: 1 | | | | |--- Type of Travel > 0.50 | | | | | |--- Customer Type <= 0.50 | | | | | | |--- Departure/Arrival time convenient <= 0.50 | | | | | | | |--- Age <= 38.00 | | | | | | | | |--- class: 1 | | | | | | | |--- Age > 38.00 | | | | | | | | |--- class: 0 | | | | | | |--- Departure/Arrival time convenient > 0.50 | | | | | | | |--- Class <= 0.50 | | | | | | | | |--- Age <= 31.00 | | | | | | | | | |--- Arrival Delay in Minutes <= 5.50 | | | | | | | | | | |--- Seat comfort <= 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Seat comfort > 3.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Arrival Delay in Minutes > 5.50 | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Age > 31.00 | | | | | | | | | |--- Age <= 36.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Age > 36.50 | | | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | | | |--- class: 1 | | | | | | | |--- Class > 0.50 | | | | | | | | |--- Gate location <= 1.50 | | | | | | | | | |--- Departure Delay in Minutes <= 6.00 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Departure Delay in Minutes > 6.00 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Gate location > 1.50 | | | | | | | | | |--- Seat comfort <= 4.50 | | | | | | | | | | |--- Inflight wifi service <= 2.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Inflight wifi service > 2.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | |--- Seat comfort > 4.50 | | | | | | | | | | |--- class: 1 | | | | | |--- Customer Type > 0.50 | | | | | | |--- class: 1 | | |--- Inflight entertainment > 4.50 | | | |--- Seat comfort <= 4.50 | | | | |--- Type of Travel <= 0.50 | | | | | |--- Gender <= 0.50 | | | | | | |--- Departure/Arrival time convenient <= 4.50 | | | | | | | |--- Arrival Delay in Minutes <= 122.00 | | | | | | | | |--- Seat comfort <= 3.50 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Seat comfort > 3.50 | | | | | | | | | |--- Leg room service <= 3.50 | | | | | | | | | | |--- Gate location <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Gate location > 4.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Leg room service > 3.50 | | | | | | | | | | |--- Baggage handling <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | | | | |--- Baggage handling > 2.50 | | | | | | | | | | | |--- truncated branch of depth 10 | | | | | | | |--- Arrival Delay in Minutes > 122.00 | | | | | | | | |--- class: 0 | | | | | | |--- Departure/Arrival time convenient > 4.50 | | | | | | | |--- Seat comfort <= 0.50 | | | | | | | | |--- class: 1 | | | | | | | |--- Seat comfort > 0.50 | | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | | |--- Leg room service <= 2.50 | | | | | | | | | | |--- Age <= 62.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Age > 62.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Leg room service > 2.50 | | | | | | | | | | |--- Seat comfort <= 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Seat comfort > 3.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | |--- Food and drink > 3.50 | | | | | | | | | |--- Gate location <= 1.50 | | | | | | | | | | |--- Age <= 68.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Age > 68.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Gate location > 1.50 | | | | | | | | | | |--- Online support <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 9 | | | | | | | | | | |--- Online support > 4.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | |--- Gender > 0.50 | | | | | | |--- Seat comfort <= 0.50 | | | | | | | |--- class: 1 | | | | | | |--- Seat comfort > 0.50 | | | | | | | |--- Seat comfort <= 3.50 | | | | | | | | |--- class: 0 | | | | | | | |--- Seat comfort > 3.50 | | | | | | | | |--- Arrival Delay in Minutes <= 5.50 | | | | | | | | | |--- Flight Distance <= 396.00 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Flight Distance > 396.00 | | | | | | | | | | |--- On-board service <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | | |--- On-board service > 3.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | |--- Arrival Delay in Minutes > 5.50 | | | | | | | | | |--- Departure Delay in Minutes <= 58.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Departure Delay in Minutes > 58.50 | | | | | | | | | | |--- Departure Delay in Minutes <= 84.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Departure Delay in Minutes > 84.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | |--- Type of Travel > 0.50 | | | | | |--- Customer Type <= 0.50 | | | | | | |--- Class <= 0.50 | | | | | | | |--- Age <= 25.50 | | | | | | | | |--- Flight Distance <= 3106.00 | | | | | | | | | |--- Arrival Delay in Minutes <= 110.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Arrival Delay in Minutes > 110.50 | | | | | | | | | | |--- Checkin service <= 4.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Checkin service > 4.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Flight Distance > 3106.00 | | | | | | | | | |--- class: 0 | | | | | | | |--- Age > 25.50 | | | | | | | | |--- Cleanliness <= 3.50 | | | | | | | | | |--- class: 0 | | | | | | | | |--- Cleanliness > 3.50 | | | | | | | | | |--- Cleanliness <= 4.50 | | | | | | | | | | |--- Flight Distance <= 2571.00 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Flight Distance > 2571.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Cleanliness > 4.50 | | | | | | | | | | |--- Arrival Delay in Minutes <= 76.00 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Arrival Delay in Minutes > 76.00 | | | | | | | | | | | |--- class: 1 | | | | | | |--- Class > 0.50 | | | | | | | |--- Flight Distance <= 2220.00 | | | | | | | | |--- On-board service <= 3.50 | | | | | | | | | |--- Flight Distance <= 2206.00 | | | | | | | | | | |--- Seat comfort <= 0.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Seat comfort > 0.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | |--- Flight Distance > 2206.00 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- On-board service > 3.50 | | | | | | | | | |--- Departure Delay in Minutes <= 13.00 | | | | | | | | | | |--- Online support <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | | |--- Online support > 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Departure Delay in Minutes > 13.00 | | | | | | | | | | |--- Inflight wifi service <= 0.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Inflight wifi service > 0.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | |--- Flight Distance > 2220.00 | | | | | | | | |--- Gate location <= 1.50 | | | | | | | | | |--- Ease of Online booking <= 2.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Ease of Online booking > 2.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Gate location > 1.50 | | | | | | | | | |--- class: 0 | | | | | |--- Customer Type > 0.50 | | | | | | |--- Inflight wifi service <= 0.50 | | | | | | | |--- Flight Distance <= 4330.00 | | | | | | | | |--- class: 1 | | | | | | | |--- Flight Distance > 4330.00 | | | | | | | | |--- class: 0 | | | | | | |--- Inflight wifi service > 0.50 | | | | | | | |--- Class <= 0.50 | | | | | | | | |--- class: 1 | | | | | | | |--- Class > 0.50 | | | | | | | | |--- Age <= 61.50 | | | | | | | | | |--- Departure Delay in Minutes <= 14.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Departure Delay in Minutes > 14.50 | | | | | | | | | | |--- Departure/Arrival time convenient <= 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Departure/Arrival time convenient > 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Age > 61.50 | | | | | | | | | |--- Flight Distance <= 2334.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Flight Distance > 2334.50 | | | | | | | | | | |--- class: 0 | | | |--- Seat comfort > 4.50 | | | | |--- class: 1 | |--- Ease of Online booking > 3.50 | | |--- Customer Type <= 0.50 | | | |--- Seat comfort <= 4.50 | | | | |--- Class <= 0.50 | | | | | |--- Age <= 24.50 | | | | | | |--- On-board service <= 2.50 | | | | | | | |--- Departure/Arrival time convenient <= 0.50 | | | | | | | | |--- class: 1 | | | | | | | |--- Departure/Arrival time convenient > 0.50 | | | | | | | | |--- Age <= 23.50 | | | | | | | | | |--- class: 0 | | | | | | | | |--- Age > 23.50 | | | | | | | | | |--- Checkin service <= 3.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Checkin service > 3.50 | | | | | | | | | | |--- class: 1 | | | | | | |--- On-board service > 2.50 | | | | | | | |--- Checkin service <= 1.50 | | | | | | | | |--- Departure Delay in Minutes <= 203.00 | | | | | | | | | |--- class: 0 | | | | | | | | |--- Departure Delay in Minutes > 203.00 | | | | | | | | | |--- class: 1 | | | | | | | |--- Checkin service > 1.50 | | | | | | | | |--- Flight Distance <= 4693.50 | | | | | | | | | |--- Baggage handling <= 3.50 | | | | | | | | | | |--- Flight Distance <= 1250.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Flight Distance > 1250.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Baggage handling > 3.50 | | | | | | | | | | |--- Age <= 8.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Age > 8.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Flight Distance > 4693.50 | | | | | | | | | |--- class: 0 | | | | | |--- Age > 24.50 | | | | | | |--- Seat comfort <= 3.50 | | | | | | | |--- Seat comfort <= 0.50 | | | | | | | | |--- class: 1 | | | | | | | |--- Seat comfort > 0.50 | | | | | | | | |--- Flight Distance <= 1832.00 | | | | | | | | | |--- Leg room service <= 4.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Leg room service > 4.50 | | | | | | | | | | |--- On-board service <= 2.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- On-board service > 2.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Flight Distance > 1832.00 | | | | | | | | | |--- class: 0 | | | | | | |--- Seat comfort > 3.50 | | | | | | | |--- On-board service <= 2.50 | | | | | | | | |--- Cleanliness <= 2.50 | | | | | | | | | |--- Flight Distance <= 2022.50 | | | | | | | | | | |--- Age <= 37.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Age > 37.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Flight Distance > 2022.50 | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Cleanliness > 2.50 | | | | | | | | | |--- Arrival Delay in Minutes <= 52.50 | | | | | | | | | | |--- Baggage handling <= 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Baggage handling > 1.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Arrival Delay in Minutes > 52.50 | | | | | | | | | | |--- On-board service <= 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- On-board service > 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | |--- On-board service > 2.50 | | | | | | | | |--- Age <= 36.50 | | | | | | | | | |--- Age <= 30.50 | | | | | | | | | | |--- Departure Delay in Minutes <= 38.50 | | | | | | | | | | | |--- truncated branch of depth 18 | | | | | | | | | | |--- Departure Delay in Minutes > 38.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | |--- Age > 30.50 | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Age > 36.50 | | | | | | | | | |--- Arrival Delay in Minutes <= 70.50 | | | | | | | | | | |--- Arrival Delay in Minutes <= 10.50 | | | | | | | | | | | |--- truncated branch of depth 14 | | | | | | | | | | |--- Arrival Delay in Minutes > 10.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | |--- Arrival Delay in Minutes > 70.50 | | | | | | | | | | |--- class: 1 | | | | |--- Class > 0.50 | | | | | |--- Age <= 24.50 | | | | | | |--- Seat comfort <= 3.50 | | | | | | | |--- Seat comfort <= 0.50 | | | | | | | | |--- class: 1 | | | | | | | |--- Seat comfort > 0.50 | | | | | | | | |--- Gate location <= 1.50 | | | | | | | | | |--- Departure Delay in Minutes <= 17.00 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Departure Delay in Minutes > 17.00 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Gate location > 1.50 | | | | | | | | | |--- class: 0 | | | | | | |--- Seat comfort > 3.50 | | | | | | | |--- On-board service <= 2.50 | | | | | | | | |--- Gate location <= 2.50 | | | | | | | | | |--- Food and drink <= 4.50 | | | | | | | | | | |--- Baggage handling <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | | |--- Baggage handling > 2.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | |--- Food and drink > 4.50 | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Gate location > 2.50 | | | | | | | | | |--- Cleanliness <= 2.50 | | | | | | | | | | |--- Checkin service <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Checkin service > 4.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Cleanliness > 2.50 | | | | | | | | | | |--- Departure/Arrival time convenient <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | | | | |--- Departure/Arrival time convenient > 4.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | |--- On-board service > 2.50 | | | | | | | | |--- Cleanliness <= 1.50 | | | | | | | | | |--- Flight Distance <= 1331.50 | | | | | | | | | | |--- Flight Distance <= 1191.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Flight Distance > 1191.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Flight Distance > 1331.50 | | | | | | | | | | |--- Age <= 13.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Age > 13.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Cleanliness > 1.50 | | | | | | | | | |--- Checkin service <= 2.50 | | | | | | | | | | |--- Baggage handling <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | | |--- Baggage handling > 2.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | | | |--- Checkin service > 2.50 | | | | | | | | | | |--- Flight Distance <= 2256.50 | | | | | | | | | | | |--- truncated branch of depth 17 | | | | | | | | | | |--- Flight Distance > 2256.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | |--- Age > 24.50 | | | | | | |--- Cleanliness <= 4.50 | | | | | | | |--- Gate location <= 2.50 | | | | | | | | |--- Inflight wifi service <= 4.50 | | | | | | | | | |--- Departure Delay in Minutes <= 39.00 | | | | | | | | | | |--- Type of Travel <= 0.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Type of Travel > 0.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | |--- Departure Delay in Minutes > 39.00 | | | | | | | | | | |--- Departure Delay in Minutes <= 112.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Departure Delay in Minutes > 112.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | |--- Inflight wifi service > 4.50 | | | | | | | | | |--- Age <= 32.00 | | | | | | | | | | |--- On-board service <= 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- On-board service > 1.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | |--- Age > 32.00 | | | | | | | | | | |--- Departure/Arrival time convenient <= 0.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Departure/Arrival time convenient > 0.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | |--- Gate location > 2.50 | | | | | | | | |--- Baggage handling <= 4.50 | | | | | | | | | |--- Age <= 25.50 | | | | | | | | | | |--- Flight Distance <= 2600.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | | | |--- Flight Distance > 2600.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | |--- Age > 25.50 | | | | | | | | | | |--- Gate location <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 10 | | | | | | | | | | |--- Gate location > 4.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | |--- Baggage handling > 4.50 | | | | | | | | | |--- Food and drink <= 4.50 | | | | | | | | | | |--- Online support <= 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Online support > 1.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | |--- Food and drink > 4.50 | | | | | | | | | | |--- class: 1 | | | | | | |--- Cleanliness > 4.50 | | | | | | | |--- Flight Distance <= 2339.00 | | | | | | | | |--- Leg room service <= 1.50 | | | | | | | | | |--- Checkin service <= 1.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Checkin service > 1.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Leg room service > 1.50 | | | | | | | | | |--- Arrival Delay in Minutes <= 21.50 | | | | | | | | | | |--- Gate location <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Gate location > 4.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Arrival Delay in Minutes > 21.50 | | | | | | | | | | |--- class: 1 | | | | | | | |--- Flight Distance > 2339.00 | | | | | | | | |--- Age <= 39.50 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Age > 39.50 | | | | | | | | | |--- class: 0 | | | |--- Seat comfort > 4.50 | | | | |--- class: 1 | | |--- Customer Type > 0.50 | | | |--- Class <= 0.50 | | | | |--- Type of Travel <= 0.50 | | | | | |--- Gender <= 0.50 | | | | | | |--- Departure Delay in Minutes <= 125.50 | | | | | | | |--- Leg room service <= 4.50 | | | | | | | | |--- Cleanliness <= 4.50 | | | | | | | | | |--- Leg room service <= 3.50 | | | | | | | | | | |--- Online boarding <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Online boarding > 3.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | |--- Leg room service > 3.50 | | | | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Food and drink > 3.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | | |--- Cleanliness > 4.50 | | | | | | | | | |--- Food and drink <= 2.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Food and drink > 2.50 | | | | | | | | | | |--- Seat comfort <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 9 | | | | | | | | | | |--- Seat comfort > 4.50 | | | | | | | | | | | |--- class: 1 | | | | | | | |--- Leg room service > 4.50 | | | | | | | | |--- Baggage handling <= 1.50 | | | | | | | | | |--- Online boarding <= 3.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Online boarding > 3.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Baggage handling > 1.50 | | | | | | | | | |--- Age <= 10.50 | | | | | | | | | | |--- On-board service <= 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- On-board service > 3.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Age > 10.50 | | | | | | | | | | |--- class: 1 | | | | | | |--- Departure Delay in Minutes > 125.50 | | | | | | | |--- Age <= 47.00 | | | | | | | | |--- class: 1 | | | | | | | |--- Age > 47.00 | | | | | | | | |--- class: 0 | | | | | |--- Gender > 0.50 | | | | | | |--- Seat comfort <= 4.50 | | | | | | | |--- Seat comfort <= 3.50 | | | | | | | | |--- Seat comfort <= 0.50 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Seat comfort > 0.50 | | | | | | | | | |--- class: 0 | | | | | | | |--- Seat comfort > 3.50 | | | | | | | | |--- Departure Delay in Minutes <= 19.50 | | | | | | | | | |--- Departure Delay in Minutes <= 7.50 | | | | | | | | | | |--- Flight Distance <= 380.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Flight Distance > 380.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | | | | | |--- Departure Delay in Minutes > 7.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Departure Delay in Minutes > 19.50 | | | | | | | | | |--- class: 0 | | | | | | |--- Seat comfort > 4.50 | | | | | | | |--- class: 1 | | | | |--- Type of Travel > 0.50 | | | | | |--- Checkin service <= 2.50 | | | | | | |--- Seat comfort <= 3.50 | | | | | | | |--- Gate location <= 4.50 | | | | | | | | |--- Leg room service <= 0.50 | | | | | | | | | |--- class: 0 | | | | | | | | |--- Leg room service > 0.50 | | | | | | | | | |--- Flight Distance <= 243.00 | | | | | | | | | | |--- Baggage handling <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Baggage handling > 2.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | |--- Flight Distance > 243.00 | | | | | | | | | | |--- Gate location <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | | | | | | |--- Gate location > 3.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | |--- Gate location > 4.50 | | | | | | | | |--- Departure/Arrival time convenient <= 4.50 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Departure/Arrival time convenient > 4.50 | | | | | | | | | |--- class: 0 | | | | | | |--- Seat comfort > 3.50 | | | | | | | |--- Gate location <= 3.50 | | | | | | | | |--- class: 0 | | | | | | | |--- Gate location > 3.50 | | | | | | | | |--- Inflight entertainment <= 4.50 | | | | | | | | | |--- Seat comfort <= 4.50 | | | | | | | | | | |--- Cleanliness <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 18 | | | | | | | | | | |--- Cleanliness > 4.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Seat comfort > 4.50 | | | | | | | | | | |--- Gate location <= 4.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Gate location > 4.50 | | | | | | | | | | | |--- truncated branch of depth 5 | | | | | | | | |--- Inflight entertainment > 4.50 | | | | | | | | | |--- Arrival Delay in Minutes <= 38.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Arrival Delay in Minutes > 38.50 | | | | | | | | | | |--- Arrival Delay in Minutes <= 41.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Arrival Delay in Minutes > 41.00 | | | | | | | | | | | |--- class: 1 | | | | | |--- Checkin service > 2.50 | | | | | | |--- Online boarding <= 2.50 | | | | | | | |--- Leg room service <= 4.50 | | | | | | | | |--- Inflight entertainment <= 4.50 | | | | | | | | | |--- Checkin service <= 4.50 | | | | | | | | | | |--- Seat comfort <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Seat comfort > 3.50 | | | | | | | | | | | |--- truncated branch of depth 9 | | | | | | | | | |--- Checkin service > 4.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Inflight entertainment > 4.50 | | | | | | | | | |--- class: 1 | | | | | | | |--- Leg room service > 4.50 | | | | | | | | |--- class: 1 | | | | | | |--- Online boarding > 2.50 | | | | | | | |--- Baggage handling <= 3.50 | | | | | | | | |--- Seat comfort <= 3.50 | | | | | | | | | |--- Online support <= 3.50 | | | | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 6 | | | | | | | | | | |--- Food and drink > 3.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Online support > 3.50 | | | | | | | | | | |--- Flight Distance <= 163.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Flight Distance > 163.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | |--- Seat comfort > 3.50 | | | | | | | | | |--- Gate location <= 3.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Gate location > 3.50 | | | | | | | | | | |--- Inflight entertainment <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 15 | | | | | | | | | | |--- Inflight entertainment > 4.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | |--- Baggage handling > 3.50 | | | | | | | | |--- On-board service <= 2.50 | | | | | | | | | |--- Seat comfort <= 3.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Seat comfort > 3.50 | | | | | | | | | | |--- Gate location <= 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | | | | |--- Gate location > 3.50 | | | | | | | | | | | |--- truncated branch of depth 10 | | | | | | | | |--- On-board service > 2.50 | | | | | | | | | |--- Leg room service <= 0.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Leg room service > 0.50 | | | | | | | | | | |--- Online support <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 9 | | | | | | | | | | |--- Online support > 3.50 | | | | | | | | | | | |--- truncated branch of depth 16 | | | |--- Class > 0.50 | | | | |--- Gender <= 0.50 | | | | | |--- Departure Delay in Minutes <= 128.50 | | | | | | |--- Inflight entertainment <= 4.50 | | | | | | | |--- Seat comfort <= 3.50 | | | | | | | | |--- Departure/Arrival time convenient <= 4.50 | | | | | | | | | |--- Type of Travel <= 0.50 | | | | | | | | | | |--- Arrival Delay in Minutes <= 136.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Arrival Delay in Minutes > 136.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Type of Travel > 0.50 | | | | | | | | | | |--- Online boarding <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Online boarding > 4.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Departure/Arrival time convenient > 4.50 | | | | | | | | | |--- Seat comfort <= 2.50 | | | | | | | | | | |--- Departure Delay in Minutes <= 111.00 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Departure Delay in Minutes > 111.00 | | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- Seat comfort > 2.50 | | | | | | | | | | |--- Gate location <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | | |--- Gate location > 3.50 | | | | | | | | | | | |--- class: 0 | | | | | | | |--- Seat comfort > 3.50 | | | | | | | | |--- Seat comfort <= 4.50 | | | | | | | | | |--- Gate location <= 3.50 | | | | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 22 | | | | | | | | | | |--- Food and drink > 3.50 | | | | | | | | | | | |--- truncated branch of depth 25 | | | | | | | | | |--- Gate location > 3.50 | | | | | | | | | | |--- On-board service <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 16 | | | | | | | | | | |--- On-board service > 3.50 | | | | | | | | | | | |--- truncated branch of depth 15 | | | | | | | | |--- Seat comfort > 4.50 | | | | | | | | | |--- Cleanliness <= 3.50 | | | | | | | | | | |--- Departure/Arrival time convenient <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 7 | | | | | | | | | | |--- Departure/Arrival time convenient > 3.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | |--- Cleanliness > 3.50 | | | | | | | | | | |--- On-board service <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | | | | | |--- On-board service > 2.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | |--- Inflight entertainment > 4.50 | | | | | | | |--- Departure/Arrival time convenient <= 3.50 | | | | | | | | |--- Arrival Delay in Minutes <= 132.00 | | | | | | | | | |--- Food and drink <= 3.50 | | | | | | | | | | |--- Online boarding <= 1.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Online boarding > 1.50 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | |--- Food and drink > 3.50 | | | | | | | | | | |--- Departure/Arrival time convenient <= 0.50 | | | | | | | | | | | |--- truncated branch of depth 2 | | | | | | | | | | |--- Departure/Arrival time convenient > 0.50 | | | | | | | | | | | |--- truncated branch of depth 9 | | | | | | | | |--- Arrival Delay in Minutes > 132.00 | | | | | | | | | |--- class: 0 | | | | | | | |--- Departure/Arrival time convenient > 3.50 | | | | | | | | |--- Seat comfort <= 4.50 | | | | | | | | | |--- Departure/Arrival time convenient <= 4.50 | | | | | | | | | | |--- Gate location <= 3.50 | | | | | | | | | | | |--- truncated branch of depth 8 | | | | | | | | | | |--- Gate location > 3.50 | | | | | | | | | | | |--- truncated branch of depth 15 | | | | | | | | | |--- Departure/Arrival time convenient > 4.50 | | | | | | | | | | |--- Type of Travel <= 0.50 | | | | | | | | | | | |--- truncated branch of depth 11 | | | | | | | | | | |--- Type of Travel > 0.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | |--- Seat comfort > 4.50 | | | | | | | | | |--- class: 1 | | | | | |--- Departure Delay in Minutes > 128.50 | | | | | | |--- Type of Travel <= 0.50 | | | | | | | |--- Online support <= 3.50 | | | | | | | | |--- Inflight wifi service <= 3.50 | | | | | | | | | |--- class: 0 | | | | | | | | |--- Inflight wifi service > 3.50 | | | | | | | | | |--- On-board service <= 4.50 | | | | | | | | | | |--- class: 0 | | | | | | | | | |--- On-board service > 4.50 | | | | | | | | | | |--- class: 1 | | | | | | | |--- Online support > 3.50 | | | | | | | | |--- class: 0 | | | | | | |--- Type of Travel > 0.50 | | | | | | | |--- Age <= 68.00 | | | | | | | | |--- class: 1 | | | | | | | |--- Age > 68.00 | | | | | | | | |--- class: 0 | | | | |--- Gender > 0.50 | | | | | |--- Type of Travel <= 0.50 | | | | | | |--- Seat comfort <= 4.50 | | | | | | | |--- Seat comfort <= 3.50 | | | | | | | | |--- Seat comfort <= 0.50 | | | | | | | | | |--- class: 1 | | | | | | | | |--- Seat comfort > 0.50 | | | | | | | | | |--- class: 0 | | | | | | | |--- Seat comfort > 3.50 | | | | | | | | |--- Arrival Delay in Minutes <= 4.50 | | | | | | | | | |--- Flight Distance <= 1396.50 | | | | | | | | | | |--- Departure Delay in Minutes <= 13.50 | | | | | | | | | | | |--- truncated branch of depth 11 | | | | | | | | | | |--- Departure Delay in Minutes > 13.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Flight Distance > 1396.50 | | | | | | | | | | |--- Flight Distance <= 1463.00 | | | | | | | | | | | |--- truncated branch of depth 3 | | | | | | | | | | |--- Flight Distance > 1463.00 | | | | | | | | | | | |--- truncated branch of depth 22 | | | | | | | | |--- Arrival Delay in Minutes > 4.50 | | | | | | | | | |--- Online boarding <= 3.50 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Online boarding > 3.50 | | | | | | | | | | |--- Leg room service <= 4.50 | | | | | | | | | | | |--- truncated branch of depth 13 | | | | | | | | | | |--- Leg room service > 4.50 | | | | | | | | | | | |--- truncated branch of depth 4 | | | | | | |--- Seat comfort > 4.50 | | | | | | | |--- class: 1 | | | | | |--- Type of Travel > 0.50 | | | | | | |--- Inflight entertainment <= 4.50 | | | | | | | |--- Checkin service <= 4.50 | | | | | | | | |--- On-board service <= 4.50 | | | | | | | | | |--- Cleanliness <= 4.50 | | | | | | | | | | |--- Cleanliness <= 2.50 | | | | | | | | | | | |--- truncated branch of depth 15 | | | | | | | | | | |--- Cleanliness > 2.50 | | | | | | | | | | | |--- truncated branch of depth 20 | | | | | | | | | |--- Cleanliness > 4.50 | | | | | | | | | | |--- class: 1 | | | | | | | | |--- On-board service > 4.50 | | | | | | | | | |--- Departure Delay in Minutes <= 146.00 | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- Departure Delay in Minutes > 146.00 | | | | | | | | | | |--- Inflight wifi service <= 1.50 | | | | | | | | | | | |--- class: 1 | | | | | | | | | | |--- Inflight wifi service > 1.50 | | | | | | | | | | | |--- class: 0 | | | | | | | |--- Checkin service > 4.50 | | | | | | | | |--- class: 1 | | | | | | |--- Inflight entertainment > 4.50 | | | | | | | |--- class: 1
colNames = df.columns.tolist()
fig = plt.figure(figsize=(25,20))
_ = tree.plot_tree(model_dt,
feature_names=colNames,
class_names=["SAT", "UNSAT"],
filled=True,
impurity=False, label=None)
In this section, we demonstrate the construction of an interpretable Decision Tree model with a limited maximum depth. This approach enhances model interpretability by creating a more concise tree that captures essential decision points.
model_dt2 = DecisionTreeClassifier(max_depth=2)
model_dt2.fit(train, labels_train)
accuracy = model_dt2.score(test, labels_test)
print("Accuracy:", round(accuracy * 100, 2), "%")
Accuracy: 82.92 %
text_representation = tree.export_text(model_dt2,
feature_names = feature_names)
print(text_representation)
|--- Inflight entertainment <= 3.50 | |--- Seat comfort <= 3.50 | | |--- class: 0 | |--- Seat comfort > 3.50 | | |--- class: 1 |--- Inflight entertainment > 3.50 | |--- Ease of Online booking <= 3.50 | | |--- class: 1 | |--- Ease of Online booking > 3.50 | | |--- class: 1
The Decision Tree has learned a set of rules to classify instances into two classes (0 and 1) based on features. It identifies conditions under which customers are more likely to be satisfied (class 1) or dissatisfied (class 0).
Inflight Entertainment:
If the "Inflight entertainment" score is less than or equal to 3.50, customers are directed to the left branch. This suggests that customers who rate the inflight entertainment experience poorly (less than or equal to 3.50) might be more likely to have a negative perception overall.
Seat Comfort (Low):
For customers in the left branch (unsatisfied with inflight entertainment), if "Seat comfort" is also rated as less than or equal to 3.50, they are assigned to class 0 (UNSAT). This indicates that customers who are unhappy with both inflight entertainment and seat comfort are predicted to be dissatisfied with their overall experience.
Seat Comfort (Moderate):
For customers in the left branch (unsatisfied with inflight entertainment), if "Seat comfort" is rated higher than 3.50, they are assigned to class 1 (SAT). This suggests that despite being dissatisfied with inflight entertainment, if seat comfort is better, customers are still predicted to perceive their experience as satisfactory.
Ease of Online Booking (Low):
For customers in the right branch (satisfied with inflight entertainment), if "Ease of Online booking" is rated as less than or equal to 3.50, they are assigned to class 1 (SAT). This implies that customers who are content with inflight entertainment but find online booking difficult, are still predicted to have an overall positive experience.
Ease of Online Booking (Moderate/High):
For customers in the right branch (satisfied with inflight entertainment), if "Ease of Online booking" is rated higher than 3.50, they are assigned to class 1 (SAT). This suggests that if customers are satisfied with inflight entertainment and find online booking easy, they are predicted to have a positive perception overall.
fig = plt.figure(figsize=(25,20))
_ = tree.plot_tree(model_dt2,
feature_names=colNames,
class_names=["UNSAT", "SAT"],
filled=True,
impurity=False, label=None)
The result of this model is actually pretty similar with our final model which using "Sigmoid" and "Binary_crossentropy" which overall around 91%.
seed = 1
np.random.seed(seed)
tf.random.set_seed(seed) # for TF this needs to be run per cell.
model_extra = Sequential()
model_extra.add(Dense(1000, input_dim=22, activation='relu'))
model_extra.add(Dense(500, activation='relu'))
model_extra.add(Dense(100, activation='relu'))
model_extra.add(Dense(50, activation='relu'))
model_extra.add(Dense(10, activation='relu'))
model_extra.add(Dense(2, activation='softmax'))
# Compile model
model_extra.compile(loss='sparse_categorical_crossentropy', optimizer="adam", metrics=['acc'])
# Fit the model, but this time store the history (that is accuracy and loss for each Epoch)
results = model_extra.fit(train, labels_train, validation_data=(test, labels_test), epochs=100, batch_size=1000, verbose=1, shuffle=True)
# summarize history for loss
plot_acc_loss(results)
print("Accuracy", round(model_extra.evaluate(test,labels_test)[1]*100,2), "%")
Epoch 1/100 104/104 [==============================] - 3s 9ms/step - loss: 9.0757 - acc: 0.5161 - val_loss: 1.1040 - val_acc: 0.5588 Epoch 2/100 104/104 [==============================] - 1s 7ms/step - loss: 2.2330 - acc: 0.5509 - val_loss: 0.8201 - val_acc: 0.5500 Epoch 3/100 104/104 [==============================] - 1s 8ms/step - loss: 0.8360 - acc: 0.5963 - val_loss: 0.5962 - val_acc: 0.6427 Epoch 4/100 104/104 [==============================] - 1s 8ms/step - loss: 0.6945 - acc: 0.6610 - val_loss: 0.5151 - val_acc: 0.7537 Epoch 5/100 104/104 [==============================] - 1s 8ms/step - loss: 0.5907 - acc: 0.6887 - val_loss: 0.4862 - val_acc: 0.7761 Epoch 6/100 104/104 [==============================] - 1s 6ms/step - loss: 0.5557 - acc: 0.7160 - val_loss: 0.5532 - val_acc: 0.6914 Epoch 7/100 104/104 [==============================] - 1s 6ms/step - loss: 0.5601 - acc: 0.7254 - val_loss: 0.5125 - val_acc: 0.7498 Epoch 8/100 104/104 [==============================] - 1s 6ms/step - loss: 0.5029 - acc: 0.7581 - val_loss: 0.4405 - val_acc: 0.7995 Epoch 9/100 104/104 [==============================] - 1s 5ms/step - loss: 0.5687 - acc: 0.7303 - val_loss: 0.4364 - val_acc: 0.8133 Epoch 10/100 104/104 [==============================] - 1s 6ms/step - loss: 0.5180 - acc: 0.7541 - val_loss: 0.4386 - val_acc: 0.7929 Epoch 11/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4732 - acc: 0.7783 - val_loss: 0.5236 - val_acc: 0.7284 Epoch 12/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4759 - acc: 0.7792 - val_loss: 0.4176 - val_acc: 0.8245 Epoch 13/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4632 - acc: 0.7862 - val_loss: 0.4209 - val_acc: 0.8228 Epoch 14/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4646 - acc: 0.7873 - val_loss: 0.4079 - val_acc: 0.8222 Epoch 15/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4222 - acc: 0.8137 - val_loss: 0.4155 - val_acc: 0.8121 Epoch 16/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4236 - acc: 0.8143 - val_loss: 0.4200 - val_acc: 0.8055 Epoch 17/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4479 - acc: 0.7995 - val_loss: 0.4456 - val_acc: 0.7865 Epoch 18/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4435 - acc: 0.8008 - val_loss: 0.6491 - val_acc: 0.6854 Epoch 19/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4283 - acc: 0.8107 - val_loss: 0.4509 - val_acc: 0.8060 Epoch 20/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4697 - acc: 0.7867 - val_loss: 0.4158 - val_acc: 0.8098 Epoch 21/100 104/104 [==============================] - 1s 6ms/step - loss: 0.4132 - acc: 0.8186 - val_loss: 0.4110 - val_acc: 0.8123 Epoch 22/100 104/104 [==============================] - 1s 6ms/step - loss: 0.4240 - acc: 0.8126 - val_loss: 0.4357 - val_acc: 0.8145 Epoch 23/100 104/104 [==============================] - 1s 7ms/step - loss: 0.6921 - acc: 0.7303 - val_loss: 0.5264 - val_acc: 0.7387 Epoch 24/100 104/104 [==============================] - 1s 6ms/step - loss: 0.4566 - acc: 0.7923 - val_loss: 0.3960 - val_acc: 0.8381 Epoch 25/100 104/104 [==============================] - 1s 7ms/step - loss: 0.3949 - acc: 0.8314 - val_loss: 0.4226 - val_acc: 0.8150 Epoch 26/100 104/104 [==============================] - 1s 7ms/step - loss: 0.3958 - acc: 0.8270 - val_loss: 0.3778 - val_acc: 0.8420 Epoch 27/100 104/104 [==============================] - 1s 7ms/step - loss: 0.3831 - acc: 0.8359 - val_loss: 0.3783 - val_acc: 0.8315 Epoch 28/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3793 - acc: 0.8354 - val_loss: 0.3607 - val_acc: 0.8463 Epoch 29/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3766 - acc: 0.8367 - val_loss: 0.3755 - val_acc: 0.8333 Epoch 30/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3797 - acc: 0.8341 - val_loss: 0.3463 - val_acc: 0.8516 Epoch 31/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3739 - acc: 0.8362 - val_loss: 0.3524 - val_acc: 0.8527 Epoch 32/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3614 - acc: 0.8424 - val_loss: 0.4338 - val_acc: 0.8079 Epoch 33/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3508 - acc: 0.8484 - val_loss: 0.3366 - val_acc: 0.8591 Epoch 34/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3692 - acc: 0.8375 - val_loss: 0.3371 - val_acc: 0.8543 Epoch 35/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3474 - acc: 0.8497 - val_loss: 0.3583 - val_acc: 0.8417 Epoch 36/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3505 - acc: 0.8464 - val_loss: 0.3300 - val_acc: 0.8599 Epoch 37/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3322 - acc: 0.8568 - val_loss: 0.3403 - val_acc: 0.8543 Epoch 38/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3338 - acc: 0.8547 - val_loss: 0.3177 - val_acc: 0.8630 Epoch 39/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3333 - acc: 0.8551 - val_loss: 0.3325 - val_acc: 0.8562 Epoch 40/100 104/104 [==============================] - 1s 5ms/step - loss: 0.7532 - acc: 0.7615 - val_loss: 1.3166 - val_acc: 0.5648 Epoch 41/100 104/104 [==============================] - 1s 5ms/step - loss: 0.4540 - acc: 0.8011 - val_loss: 0.3570 - val_acc: 0.8520 Epoch 42/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3469 - acc: 0.8521 - val_loss: 0.3267 - val_acc: 0.8620 Epoch 43/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3401 - acc: 0.8529 - val_loss: 0.3263 - val_acc: 0.8611 Epoch 44/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3356 - acc: 0.8551 - val_loss: 0.3323 - val_acc: 0.8575 Epoch 45/100 104/104 [==============================] - 1s 7ms/step - loss: 0.3321 - acc: 0.8552 - val_loss: 0.3351 - val_acc: 0.8529 Epoch 46/100 104/104 [==============================] - 1s 7ms/step - loss: 0.3192 - acc: 0.8616 - val_loss: 0.3775 - val_acc: 0.8267 Epoch 47/100 104/104 [==============================] - 1s 7ms/step - loss: 0.3160 - acc: 0.8634 - val_loss: 0.4199 - val_acc: 0.8145 Epoch 48/100 104/104 [==============================] - 1s 8ms/step - loss: 0.3161 - acc: 0.8636 - val_loss: 0.3287 - val_acc: 0.8553 Epoch 49/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3015 - acc: 0.8716 - val_loss: 0.3093 - val_acc: 0.8693 Epoch 50/100 104/104 [==============================] - 1s 6ms/step - loss: 0.3114 - acc: 0.8659 - val_loss: 0.3030 - val_acc: 0.8701 Epoch 51/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3077 - acc: 0.8670 - val_loss: 0.2954 - val_acc: 0.8727 Epoch 52/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3094 - acc: 0.8655 - val_loss: 0.3206 - val_acc: 0.8601 Epoch 53/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2980 - acc: 0.8715 - val_loss: 0.3025 - val_acc: 0.8710 Epoch 54/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2915 - acc: 0.8744 - val_loss: 0.3180 - val_acc: 0.8600 Epoch 55/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2902 - acc: 0.8748 - val_loss: 0.3562 - val_acc: 0.8464 Epoch 56/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3283 - acc: 0.8580 - val_loss: 0.3046 - val_acc: 0.8691 Epoch 57/100 104/104 [==============================] - 1s 5ms/step - loss: 0.3012 - acc: 0.8712 - val_loss: 0.2899 - val_acc: 0.8758 Epoch 58/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2820 - acc: 0.8785 - val_loss: 0.2882 - val_acc: 0.8740 Epoch 59/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2849 - acc: 0.8777 - val_loss: 0.2681 - val_acc: 0.8856 Epoch 60/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2824 - acc: 0.8788 - val_loss: 0.2654 - val_acc: 0.8884 Epoch 61/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2664 - acc: 0.8866 - val_loss: 0.2604 - val_acc: 0.8875 Epoch 62/100 104/104 [==============================] - 1s 6ms/step - loss: 0.2705 - acc: 0.8839 - val_loss: 0.2497 - val_acc: 0.8941 Epoch 63/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2655 - acc: 0.8858 - val_loss: 0.2406 - val_acc: 0.8985 Epoch 64/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2604 - acc: 0.8889 - val_loss: 0.2543 - val_acc: 0.8904 Epoch 65/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2530 - acc: 0.8911 - val_loss: 0.2432 - val_acc: 0.8949 Epoch 66/100 104/104 [==============================] - 1s 5ms/step - loss: 0.2643 - acc: 0.8855 - val_loss: 0.2427 - val_acc: 0.8979 Epoch 67/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2562 - acc: 0.8892 - val_loss: 0.2533 - val_acc: 0.8917 Epoch 68/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2482 - acc: 0.8929 - val_loss: 0.2376 - val_acc: 0.8984 Epoch 69/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2459 - acc: 0.8935 - val_loss: 0.2656 - val_acc: 0.8843 Epoch 70/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2421 - acc: 0.8951 - val_loss: 0.2342 - val_acc: 0.9014 Epoch 71/100 104/104 [==============================] - 1s 7ms/step - loss: 0.2398 - acc: 0.8952 - val_loss: 0.2286 - val_acc: 0.9006 Epoch 72/100 104/104 [==============================] - 1s 8ms/step - loss: 0.2479 - acc: 0.8924 - val_loss: 0.3410 - val_acc: 0.8501 Epoch 73/100 104/104 [==============================] - 1s 9ms/step - loss: 0.2521 - acc: 0.8903 - val_loss: 0.2209 - val_acc: 0.9053 Epoch 74/100 104/104 [==============================] - 1s 9ms/step - loss: 0.2293 - acc: 0.9006 - val_loss: 0.2175 - val_acc: 0.9064 Epoch 75/100 104/104 [==============================] - 1s 10ms/step - loss: 0.2310 - acc: 0.8998 - val_loss: 0.2224 - val_acc: 0.9038 Epoch 76/100 104/104 [==============================] - 1s 9ms/step - loss: 0.2319 - acc: 0.8997 - val_loss: 0.2179 - val_acc: 0.9062 Epoch 77/100 104/104 [==============================] - 1s 10ms/step - loss: 0.2261 - acc: 0.9014 - val_loss: 0.2502 - val_acc: 0.8900 Epoch 78/100 104/104 [==============================] - 1s 9ms/step - loss: 0.2234 - acc: 0.9025 - val_loss: 0.2173 - val_acc: 0.9057 Epoch 79/100 104/104 [==============================] - 1s 10ms/step - loss: 0.2261 - acc: 0.9016 - val_loss: 0.2343 - val_acc: 0.8993 Epoch 80/100 104/104 [==============================] - 1s 9ms/step - loss: 0.2200 - acc: 0.9039 - val_loss: 0.2058 - val_acc: 0.9106 Epoch 81/100 104/104 [==============================] - 1s 11ms/step - loss: 0.2194 - acc: 0.9044 - val_loss: 0.2386 - val_acc: 0.8953 Epoch 82/100 104/104 [==============================] - 1s 11ms/step - loss: 0.2100 - acc: 0.9084 - val_loss: 0.2187 - val_acc: 0.9051 Epoch 83/100 104/104 [==============================] - 1s 12ms/step - loss: 0.2133 - acc: 0.9073 - val_loss: 0.2292 - val_acc: 0.9001 Epoch 84/100 104/104 [==============================] - 1s 13ms/step - loss: 0.2196 - acc: 0.9042 - val_loss: 0.2064 - val_acc: 0.9108 Epoch 85/100 104/104 [==============================] - 1s 11ms/step - loss: 0.2149 - acc: 0.9068 - val_loss: 0.1987 - val_acc: 0.9158 Epoch 86/100 104/104 [==============================] - 1s 10ms/step - loss: 0.2127 - acc: 0.9073 - val_loss: 0.2009 - val_acc: 0.9134 Epoch 87/100 104/104 [==============================] - 1s 11ms/step - loss: 0.2066 - acc: 0.9105 - val_loss: 0.2218 - val_acc: 0.9045 Epoch 88/100 104/104 [==============================] - 1s 10ms/step - loss: 0.2045 - acc: 0.9114 - val_loss: 0.2084 - val_acc: 0.9098 Epoch 89/100 104/104 [==============================] - 1s 13ms/step - loss: 0.2039 - acc: 0.9115 - val_loss: 0.2005 - val_acc: 0.9146 Epoch 90/100 104/104 [==============================] - 1s 12ms/step - loss: 0.2029 - acc: 0.9118 - val_loss: 0.2063 - val_acc: 0.9104 Epoch 91/100 104/104 [==============================] - 1s 12ms/step - loss: 0.1996 - acc: 0.9136 - val_loss: 0.1909 - val_acc: 0.9176 Epoch 92/100 104/104 [==============================] - 1s 11ms/step - loss: 0.2058 - acc: 0.9102 - val_loss: 0.1924 - val_acc: 0.9168 Epoch 93/100 104/104 [==============================] - 1s 12ms/step - loss: 0.2028 - acc: 0.9114 - val_loss: 0.2099 - val_acc: 0.9085 Epoch 94/100 104/104 [==============================] - 1s 12ms/step - loss: 0.1966 - acc: 0.9147 - val_loss: 0.1944 - val_acc: 0.9176 Epoch 95/100 104/104 [==============================] - 1s 13ms/step - loss: 0.1933 - acc: 0.9157 - val_loss: 0.1856 - val_acc: 0.9191 Epoch 96/100 104/104 [==============================] - 1s 6ms/step - loss: 0.1938 - acc: 0.9154 - val_loss: 0.1916 - val_acc: 0.9178 Epoch 97/100 104/104 [==============================] - 1s 6ms/step - loss: 0.1931 - acc: 0.9155 - val_loss: 0.1830 - val_acc: 0.9228 Epoch 98/100 104/104 [==============================] - 1s 5ms/step - loss: 0.1960 - acc: 0.9149 - val_loss: 0.1911 - val_acc: 0.9181 Epoch 99/100 104/104 [==============================] - 1s 5ms/step - loss: 0.1957 - acc: 0.9150 - val_loss: 0.1866 - val_acc: 0.9205 Epoch 100/100 104/104 [==============================] - 1s 5ms/step - loss: 0.1948 - acc: 0.9148 - val_loss: 0.1890 - val_acc: 0.9190
810/810 [==============================] - 2s 2ms/step - loss: 0.1890 - acc: 0.9190 Accuracy 91.9 %
# Predictions
train_pred = model.predict(train)
train_pred_labels = (train_pred > 0.5).astype(int)
# Accuracy
accuracy = accuracy_score(labels_train, train_pred_labels)
print("Accuracy:", round(accuracy * 100, 2), "%")
# Precision and Recall
precision = precision_score(labels_train, train_pred_labels)
recall = recall_score(labels_train, train_pred_labels)
print("Precision:", round(precision, 4))
print("Recall:", round(recall, 4))
# F1-Score
f1 = f1_score(labels_train, train_pred_labels)
print("F1-Score:", round(f1, 4))
# Confusion Matrix
conf_matrix = confusion_matrix(labels_train, train_pred_labels)
print("Confusion Matrix:")
print(conf_matrix)
# ROC Curve and AUC
fpr, tpr, thresholds = roc_curve(labels_train, train_pred)
roc_auc = roc_auc_score(labels_train, train_pred)
plt.figure(figsize=(8, 6))
plt.plot(fpr, tpr, color='darkorange', lw=2, label='ROC curve (area = %0.2f)' % roc_auc)
plt.plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('Receiver Operating Characteristic')
plt.legend(loc="lower right")
plt.show()
3238/3238 [==============================] - 6s 2ms/step Accuracy: 92.2 % Precision: 0.9689 Recall: 0.8863 F1-Score: 0.9257 Confusion Matrix: [[45191 1617] [ 6458 50323]]
F1-Score: The F1-Score is 0.9323, balancing precision and recall.
Confusion Matrix: It shows 44842 true negatives, 51294 true positives, 5487 false negatives, and 1966 false positives.
ROC Curve and AUC: The ROC curve's area is 0.98, signifying strong class differentiation.
We trained a neural network model on our dataset. The goal was to understand how the model's performance evolved over the training epochs.
Model Training: We defined a neural network architecture with multiple hidden layers and an output layer for binary classification. The model was trained using the fit function, which iteratively adjusts the model's weights to minimize the loss function.
Training Metrics: During training, we tracked two important metrics:
Validation: To ensure that our model is performing well on data it hasn't seen during training, we used a separate validation dataset. The validation metrics provide insight into the model's generalization to new data.
Results Plotting: After training, we plotted the training and validation loss, as well as the training and validation accuracy, over the course of the training epochs.
The training accuracy steadily increases, which suggests that the model is learning from the training data and improving its ability to make accurate predictions.
The validation accuracy (val_acc) also shows an increasing trend, reaching around 92.81% by the end of training. This indicates that the model is generalizing well to the validation data and is not overfitting.
The loss values (loss and val_loss) decrease during training, which is expected as the model learns to minimize the loss function.
Though the true positives are higher in numbers, the confusion matrix tells us that the model actually makes more mistakes for the positive class. That is, the false negative rate is 9.6% where the false positive rate is 4.2%. This means that the model incorrectly identifies 9.6% of satisfied customers as unsatisfied. This is not a major issue, as the airline probably learns more from unsatisfied customers (as long as the airline is aware of this model flaw). If the model is good at correctly identifiying the unsatisfied customers, the airline can learn from the predictions and adjust their services accordingly.
In this part, we just show simple classification report which include the precision, recall and f1-score for the evaluation metrics for Glassbox model as we have already discuss clearly earlier during the implementation of Glassbox model on above.
predictions = model_dt.predict(test)
report = classification_report(labels_test, predictions)
print(report)
precision recall f1-score support
0 0.93 0.94 0.94 11797
1 0.95 0.94 0.95 14101
accuracy 0.94 25898
macro avg 0.94 0.94 0.94 25898
weighted avg 0.94 0.94 0.94 25898
In this code snippet, we are using the LIME (Local Interpretable Model-agnostic Explanations) technique to explain the predictions of a model trained with softmax activation and sparse categorical crossentropy loss.
-- The output shows the original prediction probabilities for these two classes: "Satisfied" (with a probability of 0.55) and "Unsatisfied" (with a probability of 0.45).
Class 1: 0.55
Each feature along with its value and the range it falls into:
The feature values and their corresponding ranges contribute to the model's prediction for the instance.
## with softmax and sparse_categorical_crossentropy
explainer = lime.lime_tabular.LimeTabularExplainer(train, feature_names=feature_names, class_names=class_names, kernel_width=3)
exp = explainer.explain_instance(test[1], model_extra.predict, num_features=10)
exp.show_in_notebook(show_all=True)
157/157 [==============================] - 0s 2ms/step
# ***** when using binary crossentropy *****
explainer = lime.lime_tabular.LimeTabularExplainer(train,
feature_names = feature_names,
class_names=['Dissastified', 'Satisfied'],
kernel_width = 5)
### Define function for the prediction method to resize the return of predict function return from 1 to 2 array.
### This is because the lime explantion is required to have 2 instance in the predict method.
def my_predict(x):
pred = model.predict(x)
format_pred = np.concatenate([1.0-pred, pred], axis=1)
return format_pred
exp = explainer.explain_instance(test[0], my_predict, num_features=5)
exp.show_in_notebook(show_all=True)
157/157 [==============================] - 0s 2ms/step
The prediction probabilities indicate the model's confidence in each class: "Dissatisfied" (with a probability of 0.00) and "Satisfied" (with a probability of 1.00). This means that the model is very confident that the customer's experience is "Satisfied."
Looking at these values, we can interpret that the customer's age is 67, indicating a potentially positive influence on the prediction. On the other hand, features like "Gender" and "Type of Travel" have lower values, suggesting that they may have less influence on the prediction.
# predict the dataset and keep the output into correct and incorrect list
preds = model.predict(test)
pred_classes = np.where(preds > 0.5, 1, 0)
true_preds = np.argwhere(pred_classes.flatten() == labels_test).flatten()
false_preds = np.argwhere(pred_classes.flatten() != labels_test).flatten()
size_exp = 5
idx_true = np.random.choice(true_preds, size=size_exp, replace=False)
idx_false = np.random.choice(false_preds, size=size_exp, replace=False)
810/810 [==============================] - 2s 2ms/step
for num in idx_true:
exp = explainer.explain_instance(test[num], my_predict, num_features=5)
print("\nTrue Prediction:", num)
print("Predicted Class:", pred_classes[num])
print("Actual Class:", [labels_test[num]])
exp.show_in_notebook(show_all=True)
157/157 [==============================] - 0s 2ms/step True Prediction: 8970 Predicted Class: [1] Actual Class: [1]
157/157 [==============================] - 0s 2ms/step True Prediction: 25125 Predicted Class: [0] Actual Class: [0]
157/157 [==============================] - 1s 4ms/step True Prediction: 1850 Predicted Class: [0] Actual Class: [0]
157/157 [==============================] - 1s 5ms/step True Prediction: 15783 Predicted Class: [0] Actual Class: [0]
157/157 [==============================] - 1s 5ms/step True Prediction: 24748 Predicted Class: [1] Actual Class: [1]
These results are showing 5 examples of instances where the model made correct predictions. For each example, the following information is presented:
for num in idx_false:
exp = explainer.explain_instance(test[num], my_predict, num_features=5)
print("\nFalse Prediction:", num)
print("Predicted Class:", pred_classes[num])
print("Actual Class:", [labels_test[num]])
exp.show_in_notebook(show_all=True)
157/157 [==============================] - 0s 2ms/step False Prediction: 11763 Predicted Class: [0] Actual Class: [1]
157/157 [==============================] - 0s 3ms/step False Prediction: 16867 Predicted Class: [0] Actual Class: [1]
157/157 [==============================] - 1s 3ms/step False Prediction: 18009 Predicted Class: [1] Actual Class: [0]
157/157 [==============================] - 1s 3ms/step False Prediction: 3607 Predicted Class: [0] Actual Class: [1]
157/157 [==============================] - 0s 3ms/step False Prediction: 13995 Predicted Class: [0] Actual Class: [1]
These results show 5 examples where the model made incorrect predictions (false predictions). For each example, the following information is presented:
%matplotlib inline
# This can be very compute consuming and OOM erros
shapML = ShapKernel(my_predict,
train[:100],
feature_names=feature_names)
shap_local = shapML.explain_local(test[20:25], labels_test[20:25])
show(shap_local, 0)
4/4 [==============================] - 0s 3ms/step 4/4 [==============================] - 0s 5ms/step 1/1 [==============================] - 0s 67ms/step
0%| | 0/5 [00:00<?, ?it/s]
1/1 [==============================] - 0s 60ms/step 6538/6538 [==============================] - 12s 2ms/step 1/1 [==============================] - 0s 24ms/step 6538/6538 [==============================] - 11s 2ms/step 1/1 [==============================] - 0s 24ms/step 6538/6538 [==============================] - 15s 2ms/step 1/1 [==============================] - 0s 37ms/step 6538/6538 [==============================] - 11s 2ms/step 1/1 [==============================] - 0s 23ms/step 6538/6538 [==============================] - 11s 2ms/step 1/1 [==============================] - 0s 29ms/step
xplainer = shap.KernelExplainer(model, train[:100])
shap_values = xplainer.shap_values(test[20:25])
0%| | 0/5 [00:00<?, ?it/s]
shap.initjs()
shap.plots._waterfall.waterfall_legacy(xplainer.expected_value[0], shap_values[0][0], feature_names=feature_names)
shap.initjs()
shap.plots._waterfall.waterfall_legacy(xplainer.expected_value[0], shap_values[0][1], feature_names=feature_names)
shap.initjs()
shap.plots._waterfall.waterfall_legacy(xplainer.expected_value[0], shap_values[0][2], feature_names=feature_names)
shap.initjs()
shap.plots._waterfall.waterfall_legacy(xplainer.expected_value[0], shap_values[0][3], feature_names=feature_names)
shap.initjs()
shap.plots._waterfall.waterfall_legacy(xplainer.expected_value[0], shap_values[0][4], feature_names=feature_names)
shap.summary_plot(shap_values, test, feature_names=feature_names, plot_type="bar")
XAI Explaination
For both LIME and SHAP, the graphs show that seat comfort and inflight entertainment are the biggest contributing factors. That is, these factors have the biggest weights for both classes. Meaning that if either is negative (bad seats and/or no entertainment), it has a big negative impact. If they are positive (great seat and/or a lot of entertainment), they have a large positive impact. For example, the last SHAP graph shows that the average impact of the model's output for class 0 (dissatisfied) for seat comfort (for the 5 presented cases) was 0.13 and the model's output for inflight entertainment was 0.8. These are much higher than the other features. Indeed this is not a surprising result. Intuitively, these factors would make a flight more or less comfortable.
Surprisingly, it seems that the model also puts weight on the variable Gender. For both the satisfied and dissatisfied class, gender seems to be in the top 5 contributing factors. Understanding how this plays into customer satisfaction may require more research.
When comparing the correct predictions and the incorrect predictions, it is hard to recognize real trends. It seems they use the same factors. However, we do see the variable Arrival Delay in Minutes weighted more heavily in the incorrect predictions. This may indicate that the model puts too much weight on this factor and predicts cases better when this factor is not weighted in as much.
In this project, we aimed to analyze the factors influencing customer satisfaction in the airline industry using deep learning techniques and allow us to know how the deep learning model learn from the dataset (which able human to know what algorithms using / learning behind the model). The main goal was to develop a predictive model for classifying customer's satisfaction levels based on various travel-related features and using XAI techniques to explain the model for further study.